fix: add labels variants for Footnote and Caption

This commit is contained in:
Christel Westerberg
2024-10-16 11:55:40 +02:00
parent 5269fcb6c4
commit 5870a31275
17 changed files with 74 additions and 57 deletions

View File

@@ -25,13 +25,16 @@
text-decoration: var(--typography-Footnote-Regular-textDecoration);
}
.labels {
font-family: var(--typography-Footnote-Labels-fontFamily);
font-size: var(--typography-Footnote-Labels-fontSize);
font-weight: var(--typography-Footnote-Labels-fontWeight);
letter-spacing: var(--typography-Footnote-Labels-letterSpacing);
line-height: var(--typography-Footnote-Labels-lineHeight);
text-decoration: var(--typography-Footnote-Labels-textDecoration);
}
.uppercase {
font-family: var(--typography-Footnote-Regular-fontFamily);
font-size: var(--typography-Footnote-Regular-fontSize);
font-weight: var(--typography-Footnote-Bold-fontWeight);
letter-spacing: var(--typography-Footnote-Regular-letterSpacing);
line-height: var(--typography-Footnote-Regular-lineHeight);
text-decoration: var(--typography-Footnote-Regular-textDecoration);
text-transform: uppercase;
}

View File

@@ -11,20 +11,23 @@ export default function Footnote({
fontOnly = false,
textAlign,
textTransform,
type,
...props
}: FootnoteProps) {
const Comp = asChild ? Slot : "p"
const classNames = fontOnly
? footnoteFontOnlyVariants({
className,
textAlign,
textTransform,
})
className,
textAlign,
textTransform,
type,
})
: footnoteVariants({
className,
color,
textAlign,
textTransform,
})
className,
color,
textAlign,
textTransform,
type,
})
return <Comp className={classNames} {...props} />
}

View File

@@ -4,6 +4,11 @@ import styles from "./footnote.module.css"
const config = {
variants: {
type: {
regular: styles.regular,
bold: styles.bold,
label: styles.labels,
},
color: {
black: styles.black,
burgundy: styles.burgundy,
@@ -18,13 +23,11 @@ const config = {
left: styles.left,
},
textTransform: {
bold: styles.bold,
regular: styles.regular,
uppercase: styles.uppercase,
},
},
defaultVariants: {
textTransform: "regular",
type: "regular",
},
} as const
@@ -32,18 +35,21 @@ export const footnoteVariants = cva(styles.footnote, config)
const fontOnlyConfig = {
variants: {
type: {
regular: styles.regular,
bold: styles.bold,
label: styles.labels,
},
textAlign: {
center: styles.center,
left: styles.left,
},
textTransform: {
bold: styles.bold,
regular: styles.regular,
uppercase: styles.uppercase,
},
},
defaultVariants: {
textTransform: "regular",
type: "regular",
},
} as const