From 79e0a085ba902393e8c75b01bfa5475dd1ac8fad Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Fri, 17 Jan 2025 13:38:28 +0900 Subject: [PATCH] Add figma color name mapping to Colors story --- packages/ui-next/src/preset.ts | 13 ---- .../ui-next/src/stories/colors.stories.tsx | 68 ++++++++++++++++--- 2 files changed, 57 insertions(+), 24 deletions(-) diff --git a/packages/ui-next/src/preset.ts b/packages/ui-next/src/preset.ts index f43337c25..a20881573 100644 --- a/packages/ui-next/src/preset.ts +++ b/packages/ui-next/src/preset.ts @@ -16,24 +16,16 @@ export const cartridgeTWPreset: Partial = { transparent: "transparent", current: "currentColor", background: { - // bg-background DEFAULT: "hsl(var(--background))", - // solid-fills/bg-primary 100: "hsl(var(--background-100))", - // solid-fills/bg-secondary 200: "hsl(var(--background-200))", - // solid-fills/bg-tertiary 300: "hsl(var(--background-300))", }, - // text-primary foreground: "hsl(var(--foreground))", primary: { - // Overwritten by theme.colors.primary DEFAULT: "hsl(var(--primary))", - // Overwritten by theme.colors.primaryForeground foreground: "hsl(var(--primary-foreground))", }, - // Mainly for Duotone icons secondary: "hsl(var(--secondary))", destructive: { DEFAULT: "hsl(var(--destructive))", @@ -41,20 +33,15 @@ export const cartridgeTWPreset: Partial = { foreground: "hsl(var(--destructive-foreground))", }, muted: { - // TODO: bg.muted DEFAULT: "hsl(var(--muted))", - // TODO: text.secondary foreground: "hsl(var(--muted-foreground))", }, accent: { - // TODO: bg.accent DEFAULT: "hsl(var(--accent))", - // TODO: text.secondary-accent foreground: "hsl(var(--accent-foreground))", }, border: "hsl(var(--background)/0.12)", input: "hsl(var(--background-200)/0.12)", - // solid-fills/spacer spacer: "hsl(var(--spacer))", }, extend: { diff --git a/packages/ui-next/src/stories/colors.stories.tsx b/packages/ui-next/src/stories/colors.stories.tsx index 1347db6cc..d0a0f51b1 100644 --- a/packages/ui-next/src/stories/colors.stories.tsx +++ b/packages/ui-next/src/stories/colors.stories.tsx @@ -17,37 +17,36 @@ export const Surface: Story = { <>
bg-background
+
(bg-background)
bg-background-100
+
(solid-fills/bg-primary)
bg-background-200
+
(solid-fills/bg-secondary)
bg-background-300
+
(solid-fills/bg-tertiary)
), }, }; -export const Accent: Story = { +export const Text: Story = { args: { children: ( - <> -
-
bg-primary
-
text-primary-foreground
-
- -
-
bg-secondary
-
- +
+
bg-foreground
+
(text-primary)
+
text-background
+
), }, }; @@ -58,6 +57,7 @@ export const Muted: Story = {
bg-muted
text-muted-foreground
+
(text.secondary)
), }, @@ -72,6 +72,7 @@ export const Destructive: Story = {
bg-destructive-100
+
(Red/500)
bg-destructive-foreground
@@ -81,6 +82,51 @@ export const Destructive: Story = { }, }; +export const Accent: Story = { + args: { + children: ( + <> +
+
bg-primary
+
(theme.colors.primary)
+
+
text-primary-foreground
+
(theme.colors.primaryForeground)
+
+
+ +
+
bg-secondary
+
(Used in Duotone)
+
+ + ), + }, +}; + +export const Others: Story = { + args: { + children: ( + <> +
+
bg-border
+
(--background/0.12)
+
+ +
+
bg-input
+
(--background-200/0.12)
+
+ +
+
bg-spacer
+
(spacer)
+
+ + ), + }, +}; + function Colors(props: PropsWithChildren) { return
; }