feat(WEB-249): first iteration design system primitives (typography, grid)
This commit is contained in:
21
components/TempDesignSystem/Text/Subtitle/index.tsx
Normal file
21
components/TempDesignSystem/Text/Subtitle/index.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { subtitleVariants } from "./variants"
|
||||
|
||||
import type { SubtitleProps } from "./subtitle"
|
||||
|
||||
export default function Subtitle({
|
||||
children,
|
||||
className = "",
|
||||
color,
|
||||
hideEmpty = true,
|
||||
textTransform,
|
||||
}: SubtitleProps) {
|
||||
if (hideEmpty && !children) {
|
||||
return null
|
||||
}
|
||||
const classNames = subtitleVariants({
|
||||
className,
|
||||
color,
|
||||
textTransform,
|
||||
})
|
||||
return <p className={classNames}>{children}</p>
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
.subtitle {
|
||||
font-family: var(--typography-Subtitle-fontFamily);
|
||||
font-size: clamp(
|
||||
var(--typography-Subtitle-Mobile-fontSize),
|
||||
0.3vw + 15px,
|
||||
var(--typography-Subtitle-Desktop-fontSize)
|
||||
);
|
||||
font-weight: var(--typography-Subtitle-fontWeight);
|
||||
letter-spacing: var(--typography-Subtitle-letterSpacing);
|
||||
line-height: var(--typography-Subtitle-lineHeight);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.regular {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.uppercase {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.burgundy {
|
||||
color: var(--Scandic-Brand-Burgundy);
|
||||
}
|
||||
|
||||
.pale {
|
||||
color: var(--Scandic-Brand-Pale-Peach);
|
||||
}
|
||||
9
components/TempDesignSystem/Text/Subtitle/subtitle.ts
Normal file
9
components/TempDesignSystem/Text/Subtitle/subtitle.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { subtitleVariants } from "./variants"
|
||||
|
||||
import type { VariantProps } from "class-variance-authority"
|
||||
|
||||
export interface SubtitleProps
|
||||
extends Omit<React.HTMLAttributes<HTMLHeadingElement>, "color">,
|
||||
VariantProps<typeof subtitleVariants> {
|
||||
hideEmpty?: boolean
|
||||
}
|
||||
22
components/TempDesignSystem/Text/Subtitle/variants.ts
Normal file
22
components/TempDesignSystem/Text/Subtitle/variants.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
import styles from "./subtitle.module.css"
|
||||
|
||||
const config = {
|
||||
variants: {
|
||||
color: {
|
||||
burgundy: styles.burgundy,
|
||||
pale: styles.pale,
|
||||
},
|
||||
textTransform: {
|
||||
regular: styles.regular,
|
||||
uppercase: styles.uppercase,
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
color: "burgundy",
|
||||
textTransform: "regular",
|
||||
},
|
||||
} as const
|
||||
|
||||
export const subtitleVariants = cva(styles.subtitle, config)
|
||||
Reference in New Issue
Block a user