Skip to content

Commit bbe60c6

Browse files
committed
fix(): Split out tailwind theme into preset.
1 parent 5c1865e commit bbe60c6

File tree

4 files changed

+84
-79
lines changed

4 files changed

+84
-79
lines changed

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export * from "../tailwind.config";
21
export * from "./atoms/accordion";
32
export * from "./atoms/alert";
43
export * from "./atoms/alert-dialog";
@@ -41,4 +40,5 @@ export * from "./atoms/tooltip";
4140
export * from "./atoms/use-toast";
4241
export * from "./molecules/slide-in";
4342
export * from "./molecules/theme-selector";
43+
export * from "./tailwind.config";
4444
export * from "./utils";

src/tailwind.config.ts

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import typography from "@tailwindcss/typography";
2+
import { Config } from "tailwindcss";
3+
import animate from "tailwindcss-animate";
4+
export const tailwindTheme = {
5+
darkMode: ["class", ".theme-mode-dark"],
6+
theme: {
7+
container: {
8+
center: true,
9+
padding: "2rem",
10+
screens: {
11+
"2xl": "1400px",
12+
},
13+
},
14+
extend: {
15+
fontFamily: {
16+
sans: ["Inter"],
17+
},
18+
colors: {
19+
border: "hsl(var(--border))",
20+
input: "hsl(var(--input))",
21+
ring: "hsl(var(--ring))",
22+
background: "hsl(var(--background))",
23+
foreground: "hsl(var(--foreground))",
24+
primary: {
25+
DEFAULT: "hsl(var(--primary))",
26+
foreground: "hsl(var(--primary-foreground))",
27+
},
28+
secondary: {
29+
DEFAULT: "hsl(var(--secondary))",
30+
foreground: "hsl(var(--secondary-foreground))",
31+
},
32+
destructive: {
33+
DEFAULT: "hsl(var(--destructive))",
34+
foreground: "hsl(var(--destructive-foreground))",
35+
},
36+
muted: {
37+
DEFAULT: "hsl(var(--muted))",
38+
foreground: "hsl(var(--muted-foreground))",
39+
},
40+
accent: {
41+
DEFAULT: "hsl(var(--accent))",
42+
foreground: "hsl(var(--accent-foreground))",
43+
},
44+
popover: {
45+
DEFAULT: "hsl(var(--popover))",
46+
foreground: "hsl(var(--popover-foreground))",
47+
},
48+
card: {
49+
DEFAULT: "hsl(var(--card))",
50+
foreground: "hsl(var(--card-foreground))",
51+
},
52+
},
53+
borderRadius: {
54+
lg: "var(--radius)",
55+
md: "calc(var(--radius) - 2px)",
56+
sm: "calc(var(--radius) - 4px)",
57+
},
58+
keyframes: {
59+
"accordion-down": {
60+
from: { height: "0" },
61+
to: { height: "var(--radix-accordion-content-height)" },
62+
},
63+
"accordion-up": {
64+
from: { height: "var(--radix-accordion-content-height)" },
65+
to: { height: "0" },
66+
},
67+
"slide-up": {
68+
from: { opacity: "0", transform: "translateY(50%)" },
69+
to: { opacity: "1", transform: "translateY(0)" },
70+
},
71+
},
72+
animation: {
73+
"accordion-down": "accordion-down 0.2s ease-out",
74+
"accordion-up": "accordion-up 0.2s ease-out",
75+
"slide-up": "slide-up 0.6s ease-in",
76+
},
77+
},
78+
},
79+
plugins: [animate, typography],
80+
} satisfies Partial<Config>;

stories/atoms/button.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ const meta: Meta<typeof Button> = {
88
export default meta;
99

1010
export const Default: StoryObj<typeof Button> = {
11-
args: {},
11+
args: { children: "Button Text" },
1212
};

tailwind.config.ts

+2-77
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,6 @@
1-
import typography from "@tailwindcss/typography";
21
import { Config } from "tailwindcss";
3-
import animate from "tailwindcss-animate";
2+
import { tailwindTheme } from "./src";
43
export default {
5-
darkMode: ["class", ".theme-mode-dark"],
64
content: ["./src/**/*.{ts,tsx}", "./stories/**/*.{ts,tsx}"],
7-
theme: {
8-
container: {
9-
center: true,
10-
padding: "2rem",
11-
screens: {
12-
"2xl": "1400px",
13-
},
14-
},
15-
extend: {
16-
fontFamily: {
17-
sans: ["Inter"],
18-
},
19-
colors: {
20-
border: "hsl(var(--border))",
21-
input: "hsl(var(--input))",
22-
ring: "hsl(var(--ring))",
23-
background: "hsl(var(--background))",
24-
foreground: "hsl(var(--foreground))",
25-
primary: {
26-
DEFAULT: "hsl(var(--primary))",
27-
foreground: "hsl(var(--primary-foreground))",
28-
},
29-
secondary: {
30-
DEFAULT: "hsl(var(--secondary))",
31-
foreground: "hsl(var(--secondary-foreground))",
32-
},
33-
destructive: {
34-
DEFAULT: "hsl(var(--destructive))",
35-
foreground: "hsl(var(--destructive-foreground))",
36-
},
37-
muted: {
38-
DEFAULT: "hsl(var(--muted))",
39-
foreground: "hsl(var(--muted-foreground))",
40-
},
41-
accent: {
42-
DEFAULT: "hsl(var(--accent))",
43-
foreground: "hsl(var(--accent-foreground))",
44-
},
45-
popover: {
46-
DEFAULT: "hsl(var(--popover))",
47-
foreground: "hsl(var(--popover-foreground))",
48-
},
49-
card: {
50-
DEFAULT: "hsl(var(--card))",
51-
foreground: "hsl(var(--card-foreground))",
52-
},
53-
},
54-
borderRadius: {
55-
lg: "var(--radius)",
56-
md: "calc(var(--radius) - 2px)",
57-
sm: "calc(var(--radius) - 4px)",
58-
},
59-
keyframes: {
60-
"accordion-down": {
61-
from: { height: "0" },
62-
to: { height: "var(--radix-accordion-content-height)" },
63-
},
64-
"accordion-up": {
65-
from: { height: "var(--radix-accordion-content-height)" },
66-
to: { height: "0" },
67-
},
68-
"slide-up": {
69-
from: { opacity: "0", transform: "translateY(50%)" },
70-
to: { opacity: "1", transform: "translateY(0)" },
71-
},
72-
},
73-
animation: {
74-
"accordion-down": "accordion-down 0.2s ease-out",
75-
"accordion-up": "accordion-up 0.2s ease-out",
76-
"slide-up": "slide-up 0.6s ease-in",
77-
},
78-
},
79-
},
80-
plugins: [animate, typography],
5+
presets: [tailwindTheme],
816
} satisfies Config;

0 commit comments

Comments
 (0)