diff --git a/js_modules/dagster-ui/packages/ui-components/src/components/ButtonLink.tsx b/js_modules/dagster-ui/packages/ui-components/src/components/ButtonLink.tsx index d0c36e8cbe7ea..6f9d19bdd3963 100644 --- a/js_modules/dagster-ui/packages/ui-components/src/components/ButtonLink.tsx +++ b/js_modules/dagster-ui/packages/ui-components/src/components/ButtonLink.tsx @@ -1,6 +1,8 @@ -import styled, {css} from 'styled-components'; +import clsx from 'clsx'; +import {CSSProperties} from 'react'; import {Colors} from './Color'; +import styles from './css/ButtonLink.module.css'; type Colors = | string @@ -12,37 +14,20 @@ type Colors = type Underline = 'never' | 'always' | 'hover'; -const fontColor = (color: Colors) => { - if (typeof color === 'string') { - return css` - color: ${color}; - `; - } - - const {link, hover, active} = color; - return css` - color: ${link}; - ${hover ? `&:hover { color: ${hover}; }` : null} - ${active ? `&:active { color: ${active}; }` : null} - `; +const getColorVars = (color: Colors) => { + const values = typeof color === 'string' ? {link: color, hover: color, active: color} : color; + return { + '--button-link-color': values.link, + '--button-link-hover-color': values.hover, + '--button-link-active-color': values.active, + } as CSSProperties; }; -const textDecoration = (underline: Underline) => { - switch (underline) { - case 'always': - return css` - text-decoration: underline; - `; - case 'hover': - return css` - &:hover:not(:disabled) { - text-decoration: underline; - } - `; - case 'never': - default: - return null; - } +const getTextDecorationClassName = (underline: Underline) => { + return clsx( + underline === 'always' && styles.textDecorationAlways, + underline === 'hover' && styles.textDecorationHover, + ); }; interface Props extends Omit, 'color'> { @@ -50,29 +35,25 @@ interface Props extends Omit, 'col underline?: Underline; } -export const ButtonLink = styled(({color: _color, underline: _underline, ...rest}: Props) => ( -