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

@@ -48,7 +48,7 @@ export default async function Breadcrumbs() {
return ( return (
<li key={breadcrumb.uid} className={styles.listItem}> <li key={breadcrumb.uid} className={styles.listItem}>
<Footnote color="burgundy" textTransform="bold"> <Footnote color="burgundy" type="bold">
{breadcrumb.title} {breadcrumb.title}
</Footnote> </Footnote>
</li> </li>

View File

@@ -82,7 +82,7 @@ export default function DatePickerDesktop({
size="small" size="small"
theme="base" theme="base"
> >
<Caption color="white" textTransform="bold"> <Caption color="white" type="bold">
{intl.formatMessage({ id: "Select dates" })} {intl.formatMessage({ id: "Select dates" })}
</Caption> </Caption>
</Button> </Button>

View File

@@ -33,7 +33,7 @@ export default function ClearSearchButton({
type="button" type="button"
> >
<DeleteIcon color="burgundy" height={20} width={20} /> <DeleteIcon color="burgundy" height={20} width={20} />
<Caption color="burgundy" textTransform="bold"> <Caption color="burgundy" type="bold">
{intl.formatMessage({ id: "Clear searches" })} {intl.formatMessage({ id: "Clear searches" })}
</Caption> </Caption>
</button> </button>

View File

@@ -34,7 +34,7 @@ export default function Voucher() {
> >
<div className={styles.vouchers}> <div className={styles.vouchers}>
<label> <label>
<Caption color="disabled" textTransform="bold"> <Caption color="disabled" type="bold">
{vouchers} {vouchers}
</Caption> </Caption>
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */} {/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}

View File

@@ -37,7 +37,7 @@ export default function FormContent({
<Search locations={locations} /> <Search locations={locations} />
</div> </div>
<div className={styles.when}> <div className={styles.when}>
<Caption color="red" textTransform="bold"> <Caption color="red" type="bold">
{intl.formatMessage( {intl.formatMessage(
{ id: "booking.nights" }, { id: "booking.nights" },
{ totalNights: nights > 0 ? nights : 0 } { totalNights: nights > 0 ? nights : 0 }
@@ -47,7 +47,7 @@ export default function FormContent({
</div> </div>
<div className={styles.rooms}> <div className={styles.rooms}>
<label> <label>
<Caption color="red" textTransform="bold"> <Caption color="red" type="bold">
{rooms} {rooms}
</Caption> </Caption>
</label> </label>
@@ -65,11 +65,7 @@ export default function FormContent({
theme="base" theme="base"
type="submit" type="submit"
> >
<Caption <Caption color="white" type="bold" className={styles.buttonText}>
color="white"
textTransform="bold"
className={styles.buttonText}
>
{intl.formatMessage({ id: "Search" })} {intl.formatMessage({ id: "Search" })}
</Caption> </Caption>
<div className={styles.icon}> <div className={styles.icon}>

View File

@@ -107,7 +107,7 @@ export default function Form({ link, subtitle, title }: RegisterFormProps) {
</div> </div>
<div className={styles.dateField}> <div className={styles.dateField}>
<header> <header>
<Caption textTransform="bold"> <Caption type="bold">
{intl.formatMessage({ id: "Birth date" })} {intl.formatMessage({ id: "Birth date" })}
</Caption> </Caption>
</header> </header>

View File

@@ -26,7 +26,7 @@ export default function PriceList({
<div className={styles.priceRow}> <div className={styles.priceRow}>
<dt> <dt>
<Caption <Caption
textTransform="bold" type="bold"
color={publicLocalPrice ? "uiTextHighContrast" : "disabled"} color={publicLocalPrice ? "uiTextHighContrast" : "disabled"}
> >
{intl.formatMessage({ id: "Standard price" })} {intl.formatMessage({ id: "Standard price" })}
@@ -52,10 +52,7 @@ export default function PriceList({
<div className={styles.priceRow}> <div className={styles.priceRow}>
<dt> <dt>
<Caption <Caption type="bold" color={memberLocalPrice ? "red" : "disabled"}>
textTransform="bold"
color={memberLocalPrice ? "red" : "disabled"}
>
{intl.formatMessage({ id: "Member price" })} {intl.formatMessage({ id: "Member price" })}
</Caption> </Caption>
</dt> </dt>

View File

@@ -90,7 +90,7 @@ export default function FlexibilityOption({
> >
<Caption <Caption
color="uiTextHighContrast" color="uiTextHighContrast"
textTransform="bold" type="bold"
className={styles.popoverHeading} className={styles.popoverHeading}
> >
{name} {name}

View File

@@ -29,14 +29,14 @@ export default function Card({
return ( return (
<label className={styles.label} data-declined={declined}> <label className={styles.label} data-declined={declined}>
<Caption className={styles.title} textTransform="bold" uppercase> <Caption className={styles.title} type="label" uppercase>
{title} {title}
</Caption> </Caption>
{subtitle ? ( {subtitle ? (
<Caption <Caption
className={styles.subtitle} className={styles.subtitle}
color={highlightSubtitle ? "baseTextAccent" : "uiTextHighContrast"} color={highlightSubtitle ? "baseTextAccent" : "uiTextHighContrast"}
textTransform="bold" type="regular"
> >
{subtitle} {subtitle}
</Caption> </Caption>

View File

@@ -9,7 +9,7 @@ import type { LinkChipProps } from "./chip"
export default function LinkChip({ url, title }: LinkChipProps) { export default function LinkChip({ url, title }: LinkChipProps) {
return ( return (
<Caption textTransform="bold" color="burgundy" asChild> <Caption type="bold" color="burgundy" asChild>
<Link href={url} className={styles.linkChip}> <Link href={url} className={styles.linkChip}>
{title} {title}
<ChevronRightSmallIcon color="burgundy" width={20} height={20} /> <ChevronRightSmallIcon color="burgundy" width={20} height={20} />

View File

@@ -16,14 +16,13 @@ p.caption {
text-decoration: var(--typography-Caption-Bold-textDecoration); text-decoration: var(--typography-Caption-Bold-textDecoration);
} }
.uppercase { .labels {
font-family: var(--typography-Caption-Bold-fontFamily); font-family: var(--typography-Caption-Labels-fontFamily);
font-size: var(--typography-Caption-Bold-fontSize); font-size: var(--typography-Caption-Labels-fontSize);
font-weight: var(--typography-Caption-Bold-fontWeight); font-weight: var(--typography-Caption-Labels-fontWeight);
letter-spacing: var(--typography-Caption-Bold-letterSpacing); letter-spacing: var(--typography-Caption-Labels-letterSpacing);
line-height: var(--typography-Caption-Bold-lineHeight); line-height: var(--typography-Caption-Labels-lineHeight);
text-decoration: var(--typography-Caption-Bold-textDecoration); text-decoration: var(--typography-Caption-Labels-textDecoration);
text-transform: uppercase;
} }
.regular { .regular {
@@ -35,6 +34,10 @@ p.caption {
text-decoration: var(--typography-Caption-Regular-textDecoration); text-decoration: var(--typography-Caption-Regular-textDecoration);
} }
.uppercase {
text-transform: uppercase;
}
.baseTextAccent { .baseTextAccent {
color: var(--Base-Text-Accent); color: var(--Base-Text-Accent);
} }

View File

@@ -12,6 +12,7 @@ export default function Caption({
textAlign, textAlign,
textTransform, textTransform,
uppercase, uppercase,
type,
...props ...props
}: CaptionProps) { }: CaptionProps) {
const Comp = asChild ? Slot : "p" const Comp = asChild ? Slot : "p"
@@ -20,6 +21,7 @@ export default function Caption({
className, className,
textTransform, textTransform,
uppercase, uppercase,
type,
}) })
: captionVariants({ : captionVariants({
className, className,
@@ -27,6 +29,7 @@ export default function Caption({
textTransform, textTransform,
textAlign, textAlign,
uppercase, uppercase,
type,
}) })
return <Comp className={classNames} {...props} /> return <Comp className={classNames} {...props} />
} }

View File

@@ -4,6 +4,11 @@ import styles from "./caption.module.css"
const config = { const config = {
variants: { variants: {
type: {
regular: styles.regular,
bold: styles.bold,
label: styles.labels,
},
color: { color: {
baseTextAccent: styles.baseTextAccent, baseTextAccent: styles.baseTextAccent,
black: styles.black, black: styles.black,
@@ -19,8 +24,6 @@ const config = {
disabled: styles.disabled, disabled: styles.disabled,
}, },
textTransform: { textTransform: {
bold: styles.bold,
regular: styles.regular,
uppercase: styles.uppercase, uppercase: styles.uppercase,
}, },
textAlign: { textAlign: {
@@ -33,7 +36,7 @@ const config = {
}, },
defaultVariants: { defaultVariants: {
color: "black", color: "black",
textTransform: "regular", type: "regular",
}, },
} as const } as const
@@ -41,9 +44,12 @@ export const captionVariants = cva(styles.caption, config)
const fontOnlyConfig = { const fontOnlyConfig = {
variants: { variants: {
textTransform: { type: {
bold: styles.bold,
regular: styles.regular, regular: styles.regular,
bold: styles.bold,
label: styles.labels,
},
textTransform: {
uppercase: styles.uppercase, uppercase: styles.uppercase,
}, },
uppercase: { uppercase: {
@@ -51,7 +57,7 @@ const fontOnlyConfig = {
}, },
}, },
defaultVariants: { defaultVariants: {
textTransform: "regular", type: "regular",
}, },
} as const } as const

View File

@@ -25,13 +25,16 @@
text-decoration: var(--typography-Footnote-Regular-textDecoration); 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 { .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; text-transform: uppercase;
} }

View File

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

View File

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

View File

@@ -20,7 +20,7 @@ export function Tooltip<P extends TooltipPosition>({
<div className={styles.tooltipContainer} role="tooltip" aria-label={text}> <div className={styles.tooltipContainer} role="tooltip" aria-label={text}>
<div className={className}> <div className={className}>
{heading && ( {heading && (
<Caption textTransform="bold" color="white"> <Caption type="bold" color="white">
{heading} {heading}
</Caption> </Caption>
)} )}