fix(SW-719): move functions to single file

This commit is contained in:
Fredrik Thorsson
2024-11-11 10:32:36 +01:00
parent 8d06394b0f
commit 258c61c792
6 changed files with 82 additions and 85 deletions

View File

@@ -5,11 +5,13 @@ import Button from "@/components/TempDesignSystem/Button"
import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
import Body from "@/components/TempDesignSystem/Text/Body"
import Title from "@/components/TempDesignSystem/Text/Title"
import { getBodyFontColor } from "@/utils/cardBodyFontColor"
import { getScriptFontColor } from "@/utils/cardScriptFontColor"
import { getTheme } from "@/utils/cardTheme"
import { getTitleFontColor } from "@/utils/cardTitleFontColor"
import {
getBodyFontColor,
getScriptFontColor,
getTitleFontColor,
} from "../utils/cardFontColors"
import { getTheme } from "../utils/cardTheme"
import { cardVariants } from "./variants"
import styles from "./card.module.css"

View File

@@ -0,0 +1,76 @@
import { biroScriptVariants } from "@/components/TempDesignSystem/Text/BiroScript/variants"
import { bodyVariants } from "@/components/TempDesignSystem/Text/Body/variants"
import { headingVariants } from "@/components/TempDesignSystem/Text/Title/variants"
import type { VariantProps } from "class-variance-authority"
import type { CardProps } from "@/components/TempDesignSystem/Card/card"
export function getTitleFontColor(
theme: CardProps["theme"]
): VariantProps<typeof headingVariants>["color"] {
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"
}
}
export function getBodyFontColor(
theme: CardProps["theme"]
): VariantProps<typeof bodyVariants>["color"] {
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"
}
}

View File

@@ -1,27 +0,0 @@
import { CardProps } from "@/components/TempDesignSystem/Card/card"
import { bodyVariants } from "@/components/TempDesignSystem/Text/Body/variants"
import type { VariantProps } from "class-variance-authority"
export function getBodyFontColor(theme: CardProps["theme"]) {
let color: VariantProps<typeof bodyVariants>["color"]
switch (theme) {
case "one":
return (color = "primaryLight")
case "two":
return (color = "secondaryLight")
case "three":
return (color = "tertiaryLight")
case "primaryDark":
return (color = "primaryDark")
case "primaryDim":
return (color = "primaryDim")
case "primaryInverted":
return (color = "primaryLight")
case "primaryStrong":
return (color = "primaryStrong")
case "image":
return (color = "baseText")
}
}

View File

@@ -1,27 +0,0 @@
import { CardProps } from "@/components/TempDesignSystem/Card/card"
import { biroScriptVariants } from "@/components/TempDesignSystem/Text/BiroScript/variants"
import type { VariantProps } from "class-variance-authority"
export function getScriptFontColor(theme: CardProps["theme"]) {
let color: VariantProps<typeof biroScriptVariants>["color"]
switch (theme) {
case "one":
return (color = "primaryLightOnSurfaceAccent")
case "two":
return (color = "secondaryLightAccent")
case "three":
return (color = "tertiaryLightAccent")
case "primaryDark":
return (color = "pink")
case "primaryDim":
return (color = "primaryDimAccent")
case "primaryInverted":
return (color = "primaryLightOnSurfaceAccent")
case "primaryStrong":
return (color = "primaryStrongAccent")
case "image":
return (color = "baseText")
}
}

View File

@@ -1,27 +0,0 @@
import { CardProps } from "@/components/TempDesignSystem/Card/card"
import { headingVariants } from "@/components/TempDesignSystem/Text/Title/variants"
import type { VariantProps } from "class-variance-authority"
export function getTitleFontColor(theme: CardProps["theme"]) {
let color: VariantProps<typeof headingVariants>["color"]
switch (theme) {
case "one":
return (color = "primaryLight")
case "two":
return (color = "secondaryLight")
case "three":
return (color = "tertiaryLight")
case "primaryDark":
return (color = "primaryDark")
case "primaryDim":
return (color = "primaryDim")
case "primaryInverted":
return (color = "primaryLight")
case "primaryStrong":
return (color = "primaryStrong")
case "image":
return (color = "baseText")
}
}