EnxDev commented on code in PR #33256:
URL: https://github.com/apache/superset/pull/33256#discussion_r2068316167


##########
superset-frontend/packages/superset-ui-chart-controls/src/components/InfoTooltipWithTrigger.tsx:
##########
@@ -16,65 +16,101 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { CSSProperties } from 'react';
+import { KeyboardEvent, useMemo } from 'react';
+import { SerializedStyles, CSSObject } from '@emotion/react';
 import { kebabCase } from 'lodash';
-import { t } from '@superset-ui/core';
+import { css, t, useTheme, themeObject } from '@superset-ui/core';
+import {
+  CloseCircleOutlined,
+  InfoCircleOutlined,
+  WarningOutlined,
+  ThunderboltOutlined,
+  QuestionCircleOutlined,
+} from '@ant-design/icons';
 import { Tooltip, TooltipProps, TooltipPlacement } from './Tooltip';
 
 export interface InfoTooltipWithTriggerProps {
   label?: string;
   tooltip?: TooltipProps['title'];
-  icon?: string;
   onClick?: () => void;
   placement?: TooltipPlacement;
-  bsStyle?: string;
   className?: string;
-  iconsStyle?: CSSProperties;
+  iconStyle?: CSSObject | SerializedStyles;
+  type?: 'info' | 'warning' | 'notice' | 'error' | 'question';
+  iconSize?: 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';
 }
 
-export function InfoTooltipWithTrigger({
+export const InfoTooltipWithTrigger = ({
+  type,
+  iconSize = 's',
   label,
   tooltip,
-  bsStyle,
   onClick,
-  icon = 'info-circle',
   className = 'text-muted',
   placement = 'right',
-  iconsStyle = {},
-}: InfoTooltipWithTriggerProps) {
-  const iconClass = `fa fa-${icon} ${className} ${
-    bsStyle ? `text-${bsStyle}` : ''
-  }`;
+  iconStyle,
+}: InfoTooltipWithTriggerProps) => {
+  const theme = useTheme();
+
+  const infoTooltipWithTriggerVariants = useMemo(
+    () => ({
+      info: { color: theme.colorIcon, icon: <InfoCircleOutlined /> },
+      question: { color: theme.colorIcon, icon: <QuestionCircleOutlined /> },
+      warning: { color: theme.colorWarning, icon: <WarningOutlined /> },
+      notice: { color: theme.colorWarning, icon: <ThunderboltOutlined /> },
+      error: { color: theme.colorError, icon: <CloseCircleOutlined /> },
+    }),
+    [theme],
+  );
+
+  const variant = type ? infoTooltipWithTriggerVariants[type] : null;
+
+  const iconCss = css`
+    color: ${variant?.color ?? theme.colorIcon};
+    font-size: ${themeObject.getFontSize(iconSize)};

Review Comment:
   Is theme.fontSize equal to 14px, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to