Skip to content

Commit

Permalink
feat: cn develop
Browse files Browse the repository at this point in the history
  • Loading branch information
XionWCFM committed Jan 1, 2025
1 parent 86159ca commit 0b1d364
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
5 changes: 3 additions & 2 deletions packages/xds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@
"generate:component": "turbo gen react-component",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"serve-storybook": "npx serve storybook-static"
"serve-storybook": "npx serve storybook-static",
"test": "vitest"
},
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -547,7 +548,7 @@
"class-variance-authority": "catalog:",
"clsx": "catalog:",
"sonner": "^1.5.0",
"tailwind-merge": "1.14.0",
"tailwind-merge": "2.6.0",
"vaul": "^0.9.1"
},
"peerDependencies": {
Expand Down
12 changes: 12 additions & 0 deletions packages/xds/src/cn.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { cn } from "./cn";

describe("Cn를 테스트합니다.", () => {
it("Cn는", () => {
const result = cn(" text-primary-50 text-primary-100 ");
expect(result).toBe("text-primary-100");
});
it("Cn는", () => {
const result = cn(" text-primary-50 text-primary-100 text-size-5");
expect(result).toBe("text-primary-100 text-size-5");
});
});
14 changes: 11 additions & 3 deletions packages/xds/src/cn.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { type ClassValue, clsx } from "clsx";
import { extendTailwindMerge } from "tailwind-merge";

import { XION_STYLE } from "@xionwcfm/token";
import { vars } from "@xionwcfm/token";

const customTwMerge = extendTailwindMerge({
classGroups: {
"font-size": [{ text: Object.keys(XION_STYLE.fontSize) }],
extend: {
theme: {
colors: Object.entries(vars.colors).map(([key, value]) => {
const childKeys = typeof value === "object" ? Object.keys(value) : [value];
return { [key]: childKeys };
}),
},
classGroups: {
"font-size": Object.keys(vars.fontSize).map((item) => `text-${item}`),
},
},
});

Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0b1d364

Please sign in to comment.