fix(SW-719): use utils inside components folder

This commit is contained in:
Fredrik Thorsson
2024-11-11 11:14:58 +01:00
parent 258c61c792
commit b0aed971ea
3 changed files with 22 additions and 23 deletions

View File

@@ -9,9 +9,9 @@ import Title from "@/components/TempDesignSystem/Text/Title"
import {
getBodyFontColor,
getScriptFontColor,
getTheme,
getTitleFontColor,
} from "../utils/cardFontColors"
import { getTheme } from "../utils/cardTheme"
} from "./utils"
import { cardVariants } from "./variants"
import styles from "./card.module.css"

View File

@@ -4,6 +4,7 @@ import { headingVariants } from "@/components/TempDesignSystem/Text/Title/varian
import type { VariantProps } from "class-variance-authority"
import type { ButtonProps } from "@/components/TempDesignSystem/Button/button"
import type { CardProps } from "@/components/TempDesignSystem/Card/card"
export function getTitleFontColor(
@@ -74,3 +75,22 @@ export function getBodyFontColor(
return "baseText"
}
}
export function getTheme(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"
}
}

View File

@@ -1,21 +0,0 @@
import type { ButtonProps } from "@/components/TempDesignSystem/Button/button"
import type { CardProps } from "@/components/TempDesignSystem/Card/card"
export function getTheme(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"
}
}