diff --git a/package.json b/package.json index 947c760..77efbc5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bbodek-ui", - "version": "0.0.217", + "version": "0.0.218", "type": "module", "author": "Bbodek", "license": "MIT", diff --git a/src/core/components/Button/ButtonBase/constants/index.ts b/src/core/components/Button/ButtonBase/constants/index.ts index a5e26e8..b25cd44 100644 --- a/src/core/components/Button/ButtonBase/constants/index.ts +++ b/src/core/components/Button/ButtonBase/constants/index.ts @@ -1,4 +1,4 @@ -import { ColorThemeType, GapType, RoundedType, SizeType } from "../types"; +import { GapType, RoundedType, SizeType } from "../types"; export const SIZE = { SIZE_60: "h-60", @@ -24,16 +24,6 @@ export const GAP = { GAP_8: "gap-8", } as const; -export const COLOR_THEME = { - PRIMARY: "primary", - ERROR: "error", - WARNING: "warning", - SUCCESS: "success", - SECONDARY: "secondary", - GRAY: "gray", - WHITE: "white", -} as const; - export const BUTTON_SIZE: Record = { [SIZE.SIZE_60]: "h-[3.75rem]", [SIZE.SIZE_56]: "h-14", @@ -57,13 +47,3 @@ export const BUTTON_GAP: Record = { [GAP.GAP_10]: "gap-x-2.5", [GAP.GAP_8]: "gap-x-2", }; - -export const BUTTON_COLOR_THEME: Record = { - [COLOR_THEME["PRIMARY"]]: "bg-primary-03 text-white", - [COLOR_THEME["SECONDARY"]]: "text-primary-03 bg-primary-00", - [COLOR_THEME["ERROR"]]: "text-rose-600 bg-rose-300/20", - [COLOR_THEME["WARNING"]]: "text-amber-600 bg-amber-300/20", - [COLOR_THEME["SUCCESS"]]: "text-green-600 bg-green-300/20", - [COLOR_THEME["GRAY"]]: "text-gray-07 bg-gray-02", - [COLOR_THEME["WHITE"]]: "text-gray-06 bg-white border border-gray-03", -}; diff --git a/src/core/components/Button/ButtonBase/index.tsx b/src/core/components/Button/ButtonBase/index.tsx index 01aca96..2e2afc0 100644 --- a/src/core/components/Button/ButtonBase/index.tsx +++ b/src/core/components/Button/ButtonBase/index.tsx @@ -1,8 +1,9 @@ import clsx from "clsx"; import { PropsWithChildren, forwardRef } from "react"; +import { COLOR_THEME_STYLES } from "@/constants/theme"; import { THEME_TYPOGRAPHY } from "@/constants/typography"; -import { BUTTON_COLOR_THEME, BUTTON_GAP, BUTTON_ROUNDED, BUTTON_SIZE, GAP, ROUNDED, SIZE } from "./constants"; +import { BUTTON_GAP, BUTTON_ROUNDED, BUTTON_SIZE, GAP, ROUNDED, SIZE } from "./constants"; import { ButtonBaseProps, SizeType } from "./types"; const ButtonBase = forwardRef(({ @@ -34,7 +35,7 @@ ref: React.Ref, `text-${theme ?? defaultButtonTheme}`, !colorTheme && color && `text-${color}`, !colorTheme && backgroundColor && `bg-${backgroundColor}`, - colorTheme && BUTTON_COLOR_THEME[colorTheme], + colorTheme && COLOR_THEME_STYLES[colorTheme], BUTTON_SIZE[size], hasIcon && gap && BUTTON_GAP[gap], BUTTON_ROUNDED[rounded], diff --git a/src/core/components/Button/ButtonBase/types/index.ts b/src/core/components/Button/ButtonBase/types/index.ts index 12531af..2dab228 100644 --- a/src/core/components/Button/ButtonBase/types/index.ts +++ b/src/core/components/Button/ButtonBase/types/index.ts @@ -1,12 +1,10 @@ import { ButtonHTMLAttributes } from "react"; -import { ThemeColors, ThemeTypography } from "@/types"; -import { COLOR_THEME, GAP, ROUNDED, SIZE } from "../constants"; +import { ColorThemeType, ThemeColors, ThemeTypography } from "@/types"; +import { GAP, ROUNDED, SIZE } from "../constants"; export type ThemeType = Extract; -export type ColorThemeType = typeof COLOR_THEME[keyof typeof COLOR_THEME]; - export type SizeType = typeof SIZE[keyof typeof SIZE]; export type RoundedType = typeof ROUNDED[keyof typeof ROUNDED]; diff --git a/src/core/components/Label/Label.stories.tsx b/src/core/components/Label/Label.stories.tsx index b13ce10..1d59fd2 100644 --- a/src/core/components/Label/Label.stories.tsx +++ b/src/core/components/Label/Label.stories.tsx @@ -1,5 +1,6 @@ import { Meta } from "@storybook/react"; +import { colorThemeOptions } from "@/constants/theme"; import { Info } from "@phosphor-icons/react"; import Label from "./index"; import { LabelProps } from "./types"; @@ -8,10 +9,10 @@ const meta = { title: "core/Label", component: Label, argTypes: { - variants: { + colorTheme: { control: "select", - options: [ "primary", "error", "border" ], - description: "Label Variants", + options: colorThemeOptions, + description: "Label colorTheme", }, size: { control: "select", @@ -31,7 +32,7 @@ export const Primary = (props: LabelProps) => { return (