diff --git a/lib/links.css.ts b/lib/links.css.ts index 8bc6e1d..2b91fde 100644 --- a/lib/links.css.ts +++ b/lib/links.css.ts @@ -1,17 +1,50 @@ -import { style } from '@vanilla-extract/css'; +import { createVar, style, styleVariants } from '@vanilla-extract/css'; +import { genericVars } from './design-system.css.js'; import { colorThemeVars } from './schemes/color.css.js'; import { hsl } from './utils.js'; -export const linkStyle = style({ +export type LinkVariant = 'strong' | 'standard' | 'weak'; + +const linkColorVar = createVar(); + +const linkStyle = style({ + vars: { + [linkColorVar]: hsl( + colorThemeVars.accent.h, + colorThemeVars.accent.s, + colorThemeVars.accent.l, + ), + }, cursor: 'pointer', - selectors: { - '&:hover': { +}); + +export const linkStyleVariant = styleVariants( + { + strong: { + color: linkColorVar, + fontWeight: genericVars.text.weight.semiBold, + }, + standard: { + color: linkColorVar, + }, + weak: { textDecoration: 'underline', + selectors: { + '&:hover': { + color: linkColorVar, + }, + }, }, - }, - color: hsl( - colorThemeVars.accent.h, - colorThemeVars.accent.s, - colorThemeVars.accent.l, - ), -}); + } as const, + (cssProps) => [ + linkStyle, + { + selectors: { + '&:hover': { + textDecoration: 'underline', + }, + }, + ...cssProps, + }, + ], +); diff --git a/lib/links.tsx b/lib/links.tsx index 60e4035..8740156 100644 --- a/lib/links.tsx +++ b/lib/links.tsx @@ -1,16 +1,14 @@ import type { FC } from 'react'; import { Box, BoxBasedComponentProps } from './core.js'; -import { linkStyle } from './links.css.js'; +import { linkStyleVariant, LinkVariant } from './links.css.js'; -export const TextLink: FC> = ({ - children, - className, - ...props -}) => ( +export const TextLink: FC< + BoxBasedComponentProps<'span' | 'a'> & { weight?: LinkVariant } +> = ({ children, className, weight = 'standard', ...props }) => ( {children} diff --git a/src/pages/typography.tsx b/src/pages/typography.tsx index ebf7327..9582b01 100644 --- a/src/pages/typography.tsx +++ b/src/pages/typography.tsx @@ -44,13 +44,22 @@ export const TypographyPage: FC = () => ( Sometimes I like to look at{' '} - button components on my computer. + button components and{' '} + + strong panels + {' '} + or{' '} + + weak badges + {' '} + on my computer. Sometimes I like to look at{' '} - button components on my computer. + button components or on my + computer.