diff --git a/site/src/components/HelpTooltip/HelpTooltip.tsx b/site/src/components/HelpTooltip/HelpTooltip.tsx index 7b73aec706..4ec192f9ad 100644 --- a/site/src/components/HelpTooltip/HelpTooltip.tsx +++ b/site/src/components/HelpTooltip/HelpTooltip.tsx @@ -1,11 +1,3 @@ -import { - type CSSObject, - css, - type Interpolation, - type Theme, -} from "@emotion/react"; -import Link from "@mui/material/Link"; -import { Stack } from "components/Stack/Stack"; import { Tooltip, TooltipContent, @@ -66,40 +58,23 @@ export const HelpTooltipIconTrigger = forwardRef< size = "medium", children = , hoverEffect = true, + className, ...buttonProps } = props; - const hoverEffectStyles = css({ - opacity: 0.5, - "&:hover": { - opacity: 0.75, - }, - }); - return ( @@ -109,10 +84,17 @@ export const HelpTooltipIconTrigger = forwardRef< export const HelpTooltipTitle: FC> = ({ children, + className, ...attrs }) => { return ( -

+

{children}

); @@ -120,10 +102,17 @@ export const HelpTooltipTitle: FC> = ({ export const HelpTooltipText: FC> = ({ children, + className, ...attrs }) => { return ( -

+

{children}

); @@ -136,10 +125,15 @@ interface HelpTooltipLink { export const HelpTooltipLink: FC = ({ children, href }) => { return ( - - + + {children} - + ); }; @@ -160,81 +154,15 @@ export const HelpTooltipAction: FC = ({ ); }; export const HelpTooltipLinksGroup: FC = ({ children }) => { - return ( - - {children} - - ); + return
{children}
; }; - -const getIconSpacingFromSize = (size?: Size): number => { - switch (size) { - case "small": - return 12; - default: - return 16; - } -}; - -const styles = { - title: (theme) => ({ - marginTop: 0, - marginBottom: 8, - color: theme.palette.text.primary, - fontSize: 14, - lineHeight: "150%", - fontWeight: 600, - }), - - text: (theme) => ({ - marginTop: 4, - marginBottom: 4, - ...(theme.typography.body2 as CSSObject), - }), - - link: (theme) => ({ - display: "flex", - alignItems: "center", - ...(theme.typography.body2 as CSSObject), - color: theme.roles.active.fill.outline, - }), - - linkIcon: { - color: "inherit", - width: 14, - height: 14, - marginRight: 8, - }, - - linksGroup: { - marginTop: 16, - }, - - action: (theme) => ({ - display: "flex", - alignItems: "center", - background: "none", - border: 0, - color: theme.palette.primary.light, - padding: 0, - cursor: "pointer", - fontSize: 14, - }), - - actionIcon: { - color: "inherit", - width: 14, - height: 14, - marginRight: 8, - }, -} satisfies Record>; diff --git a/site/src/components/InfoTooltip/InfoTooltip.tsx b/site/src/components/InfoTooltip/InfoTooltip.tsx index 411d9aef69..8e13a13c11 100644 --- a/site/src/components/InfoTooltip/InfoTooltip.tsx +++ b/site/src/components/InfoTooltip/InfoTooltip.tsx @@ -1,4 +1,3 @@ -import { css, type Interpolation, type Theme, useTheme } from "@emotion/react"; import { HelpTooltip, HelpTooltipContent, @@ -9,6 +8,7 @@ import { } from "components/HelpTooltip/HelpTooltip"; import type { FC, ReactNode } from "react"; import type { ThemeRole } from "theme/roles"; +import { cn } from "utils/cn"; interface InfoTooltipProps { type?: ThemeRole; @@ -16,18 +16,27 @@ interface InfoTooltipProps { message: ReactNode; } +const tooltipColorClasses: Record = { + info: "text-content-secondary", + error: "text-content-destructive", + warning: "text-content-warning", + notice: "text-content-link", + success: "text-content-success", + danger: "text-content-destructive", + active: "text-content-link", + inactive: "text-highlight-grey", + preview: "text-highlight-purple", +}; + export const InfoTooltip: FC = ({ title, message, type = "info", }) => { - const theme = useTheme(); - const iconColor = theme.roles[type].outline; - return ( - - + + {title} @@ -36,13 +45,3 @@ export const InfoTooltip: FC = ({ ); }; - -const styles = { - button: css` - opacity: 1; - - &:hover { - opacity: 1; - } - `, -} satisfies Record>;