fix(SW-556): removed old caption label component, fixed outline on button

This commit is contained in:
Christian Andolf
2024-10-21 10:03:48 +02:00
parent fde233dac4
commit 3508253afe
6 changed files with 19 additions and 189 deletions

View File

@@ -1,77 +0,0 @@
p.caption {
margin: 0;
padding: 0;
}
.captionFontOnly {
font-style: normal;
}
.uppercase {
font-family: var(--typography-Caption-Labels-fontFamily);
font-size: var(--typography-Caption-Labels-fontSize);
font-weight: var(--typography-Caption-Labels-fontWeight);
letter-spacing: var(--typography-Caption-Labels-letterSpacing);
line-height: var(--typography-Caption-Labels-lineHeight);
text-transform: uppercase;
}
.regular {
font-family: var(--typography-Caption-Labels-fontFamily);
font-size: var(--typography-Caption-Labels-fontSize);
font-weight: var(--typography-Caption-Labels-fontWeight);
letter-spacing: var(--typography-Caption-Labels-letterSpacing);
line-height: var(--typography-Caption-Labels-lineHeight);
}
.baseTextAccent {
color: var(--Base-Text-Accent);
}
.black {
color: var(--Main-Grey-100);
}
.burgundy {
color: var(--Scandic-Brand-Burgundy);
}
.pale {
color: var(--Scandic-Brand-Pale-Peach);
}
.textMediumContrast {
color: var(--Base-Text-Medium-contrast);
}
.red {
color: var(--Scandic-Brand-Scandic-Red);
}
.white {
color: var(--UI-Opacity-White-100);
}
.uiTextActive {
color: var(--UI-Text-Active);
}
.uiTextMediumContrast {
color: var(--UI-Text-Medium-contrast);
}
.uiTextHighContrast {
color: var(--UI-Text-High-contrast);
}
.disabled {
color: var(--Base-Text-Disabled);
}
.center {
text-align: center;
}
.left {
text-align: left;
}

View File

@@ -1,10 +0,0 @@
import { captionVariants } from "./variants"
import type { VariantProps } from "class-variance-authority"
export interface CaptionLabelProps
extends Omit<React.HTMLAttributes<HTMLHeadingElement>, "color">,
VariantProps<typeof captionVariants> {
asChild?: boolean
fontOnly?: boolean
}

View File

@@ -1,32 +0,0 @@
import { Slot } from "@radix-ui/react-slot"
import { captionVariants, fontOnlycaptionVariants } from "./variants"
import type { CaptionLabelProps } from "./captionLabel"
export default function CaptionLabel({
asChild = false,
className = "",
color,
fontOnly = false,
textAlign,
textTransform,
uppercase,
...props
}: CaptionLabelProps) {
const Comp = asChild ? Slot : "span"
const classNames = fontOnly
? fontOnlycaptionVariants({
className,
textTransform,
uppercase,
})
: captionVariants({
className,
color,
textTransform,
textAlign,
uppercase,
})
return <Comp className={classNames} {...props} />
}

View File

@@ -1,58 +0,0 @@
import { cva } from "class-variance-authority"
import styles from "./captionLabel.module.css"
const config = {
variants: {
color: {
baseTextAccent: styles.baseTextAccent,
black: styles.black,
burgundy: styles.burgundy,
pale: styles.pale,
textMediumContrast: styles.textMediumContrast,
red: styles.red,
white: styles.white,
uiTextHighContrast: styles.uiTextHighContrast,
uiTextActive: styles.uiTextActive,
uiTextMediumContrast: styles.uiTextMediumContrast,
disabled: styles.disabled,
},
textTransform: {
regular: styles.regular,
uppercase: styles.uppercase,
},
textAlign: {
center: styles.center,
left: styles.left,
},
uppercase: {
true: styles.uppercase,
},
},
defaultVariants: {
color: "black",
textTransform: "regular",
},
} as const
export const captionVariants = cva(styles.caption, config)
const fontOnlyConfig = {
variants: {
textTransform: {
regular: styles.regular,
uppercase: styles.uppercase,
},
uppercase: {
true: styles.uppercase,
},
},
defaultVariants: {
textTransform: "regular",
},
} as const
export const fontOnlycaptionVariants = cva(
styles.captionFontOnly,
fontOnlyConfig
)