Files
web/apps/scandic-web/components/TempDesignSystem/Card/utils.ts
Anton Gunnarsson 923206ee4c Merged in chore/sw-3145-move-subtitle (pull request #2516)
chore(SW-3145): Move Title and Subtitle to design-system

* Move Title and Subtitle to design-system

* Fix export


Approved-by: Linus Flood
2025-07-04 06:22:28 +00:00

97 lines
2.5 KiB
TypeScript

import type Body from "@scandic-hotels/design-system/Body"
import type Title from "@scandic-hotels/design-system/Title"
import type { VariantProps } from "class-variance-authority"
import type { ComponentProps } from "react"
import type { ButtonProps } from "@/components/TempDesignSystem/Button/button"
import type { CardProps } from "@/components/TempDesignSystem/Card/card"
import type { biroScriptVariants } from "@/components/TempDesignSystem/Text/BiroScript/variants"
type TitleColor = ComponentProps<typeof Title>["color"]
export function getTitleFontColor(theme: CardProps["theme"]): TitleColor {
switch (theme) {
case "one":
return "primaryLight"
case "two":
return "secondaryLight"
case "three":
return "tertiaryLight"
case "primaryDark":
return "primaryDark"
case "primaryDim":
return "primaryDim"
case "primaryInverted":
return "primaryLight"
case "primaryStrong":
return "primaryStrong"
case "image":
return "baseText"
}
}
export function getScriptFontColor(
theme: CardProps["theme"]
): VariantProps<typeof biroScriptVariants>["color"] {
switch (theme) {
case "one":
return "primaryLightOnSurfaceAccent"
case "two":
return "secondaryLightAccent"
case "three":
return "tertiaryLightAccent"
case "primaryDark":
return "pink"
case "primaryDim":
return "primaryDimAccent"
case "primaryInverted":
return "primaryLightOnSurfaceAccent"
case "primaryStrong":
return "primaryStrongAccent"
case "image":
return "baseText"
}
}
type BodyColor = ComponentProps<typeof Body>["color"]
export function getBodyFontColor(theme: CardProps["theme"]): BodyColor {
switch (theme) {
case "one":
return "primaryLight"
case "two":
return "secondaryLight"
case "three":
return "tertiaryLight"
case "primaryDark":
return "primaryDark"
case "primaryDim":
return "primaryDim"
case "primaryInverted":
return "primaryLight"
case "primaryStrong":
return "primaryStrong"
case "image":
return "baseText"
}
}
export function getButtonTheme(
theme: CardProps["theme"]
): ButtonProps["theme"] {
switch (theme) {
case "two":
return "secondaryLight"
case "three":
return "tertiaryLight"
case "primaryDark":
return "primaryDark"
case "primaryStrong":
case "image":
return "primaryStrong"
case "one":
case "primaryDim":
case "primaryInverted":
default:
return "primaryLight"
}
}