From b0aed971ea67ff382104cffda2526ac64242a1d8 Mon Sep 17 00:00:00 2001 From: Fredrik Thorsson Date: Mon, 11 Nov 2024 11:14:58 +0100 Subject: [PATCH] fix(SW-719): use utils inside components folder --- components/TempDesignSystem/Card/index.tsx | 4 ++-- .../cardFontColors.ts => Card/utils.ts} | 20 ++++++++++++++++++ .../TempDesignSystem/utils/cardTheme.ts | 21 ------------------- 3 files changed, 22 insertions(+), 23 deletions(-) rename components/TempDesignSystem/{utils/cardFontColors.ts => Card/utils.ts} (80%) delete mode 100644 components/TempDesignSystem/utils/cardTheme.ts diff --git a/components/TempDesignSystem/Card/index.tsx b/components/TempDesignSystem/Card/index.tsx index 9f8a52442..329f8e7c3 100644 --- a/components/TempDesignSystem/Card/index.tsx +++ b/components/TempDesignSystem/Card/index.tsx @@ -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" diff --git a/components/TempDesignSystem/utils/cardFontColors.ts b/components/TempDesignSystem/Card/utils.ts similarity index 80% rename from components/TempDesignSystem/utils/cardFontColors.ts rename to components/TempDesignSystem/Card/utils.ts index bc9fd7f26..ad5d3707b 100644 --- a/components/TempDesignSystem/utils/cardFontColors.ts +++ b/components/TempDesignSystem/Card/utils.ts @@ -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" + } +} diff --git a/components/TempDesignSystem/utils/cardTheme.ts b/components/TempDesignSystem/utils/cardTheme.ts deleted file mode 100644 index 335d5ed3a..000000000 --- a/components/TempDesignSystem/utils/cardTheme.ts +++ /dev/null @@ -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" - } -}