Skip to content

Commit 9a0ad91

Browse files
committed
Merge branch 'dev' into feat/bottom-sheet-close-button
2 parents 0b61312 + 9446f2c commit 9a0ad91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+264
-68
lines changed

.changeset/heavy-lies-train.md

Lines changed: 6 additions & 0 deletions

docs/components/component-grid.tsx

Lines changed: 59 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,72 @@ import {
77

88
const client = createFigmaClient(process.env.FIGMA_PERSONAL_ACCESS_TOKEN!);
99

10+
function getCategoryFromPath(path: string): string | null {
11+
const match = path.match(/components\/\(([^)]+)\)\//);
12+
if (!match) return null;
13+
14+
return match[1].charAt(0).toUpperCase() + match[1].slice(1);
15+
}
16+
1017
export async function ComponentGrid() {
11-
// Get all component pages
1218
const allPages = docsSource.getPages();
1319

14-
const componentPages = allPages
15-
.filter((page) => {
16-
// Only include pages under /docs/components/
17-
if (!page.url.startsWith("/docs/components/")) return false;
20+
const categorizedPages = new Map<string, typeof allPages>();
21+
22+
for (const page of allPages) {
23+
if (!page.url.startsWith("/docs/components/")) continue;
24+
if (page.data.deprecated) continue;
1825

19-
if (page.data.deprecated) return false;
26+
const category = getCategoryFromPath(page.path);
2027

21-
return true;
22-
})
23-
.sort((a, b) => {
24-
// Sort alphabetically by title
25-
const titleA = a.data.title;
26-
const titleB = b.data.title;
28+
if (!category) continue;
2729

28-
return titleA.localeCompare(titleB);
29-
});
30+
if (!categorizedPages.has(category)) {
31+
categorizedPages.set(category, []);
32+
}
33+
34+
categorizedPages.get(category)!.push(page);
35+
}
36+
37+
for (const pages of categorizedPages.values()) {
38+
pages.sort((a, b) => a.data.title.localeCompare(b.data.title));
39+
}
40+
41+
const sortedCategories = Array.from(categorizedPages.entries()).sort(([a], [b]) =>
42+
a.localeCompare(b),
43+
);
3044

3145
return (
32-
<ul className="grid grid-cols-2 md:grid-cols-3 gap-4 pb-10 not-prose items-stretch">
33-
{componentPages.map(async (page) => {
34-
return (
35-
<li key={page.url}>
36-
<ComponentCard
37-
className="h-full"
38-
{...(page.data.coverImageFigmaId && {
39-
coverImageSrc: (
40-
await fetchFigmaImageUrls({
41-
client,
42-
fileKey: process.env.FIGMA_FILE_KEY!,
43-
nodeIds: [page.data.coverImageFigmaId],
44-
options: {
45-
scale: 3,
46-
},
47-
})
48-
).get(page.data.coverImageFigmaId),
49-
})}
50-
title={page.data.title}
51-
description={page.data.description}
52-
href={page.url}
53-
/>
54-
</li>
55-
);
56-
})}
57-
</ul>
46+
<div className="space-y-10 pb-10">
47+
{sortedCategories.map(([category, pages]) => (
48+
<section key={category}>
49+
<h2 className="text-xl font-semibold mb-4">{category}</h2>
50+
<ul className="grid grid-cols-2 md:grid-cols-3 gap-4 not-prose items-stretch">
51+
{pages.map(async (page) => (
52+
<li key={page.url}>
53+
<ComponentCard
54+
className="h-full"
55+
{...(page.data.coverImageFigmaId && {
56+
coverImageSrc: (
57+
await fetchFigmaImageUrls({
58+
client,
59+
fileKey: process.env.FIGMA_FILE_KEY!,
60+
nodeIds: [page.data.coverImageFigmaId],
61+
options: {
62+
scale: 3,
63+
},
64+
})
65+
).get(page.data.coverImageFigmaId),
66+
})}
67+
title={page.data.title}
68+
description={page.data.description}
69+
href={page.url}
70+
/>
71+
</li>
72+
))}
73+
</ul>
74+
</section>
75+
))}
76+
</div>
5877
);
5978
}

docs/components/rootage.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ export function stringifyTokenLit(token: AST.TokenLit): AST.TokenRef {
1717
}
1818

1919
export function stringifyValueLit(lit: AST.ValueLit): string {
20+
const tokenReference = (token: AST.TokenLit) => stringifyTokenLit(token);
21+
2022
switch (lit.kind) {
2123
case "DimensionLit":
2224
return lit.unit === "rem"
23-
? `${css.staticStringifier.value(lit)} (${lit.value * 16}px)`
24-
: css.staticStringifier.value(lit);
25+
? `${css.staticStringifier.value(lit, tokenReference)} (${lit.value * 16}px)`
26+
: css.staticStringifier.value(lit, tokenReference);
2527
default:
26-
return css.staticStringifier.value(lit);
28+
return css.staticStringifier.value(lit, tokenReference);
2729
}
2830
}
2931

docs/components/token-cell.tsx

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,56 @@ export interface TokenCellProps {
1919
resolvedValue: AST.ValueLit;
2020
}
2121

22+
function renderGradientWithTokens(gradient: AST.GradientLit) {
23+
return (
24+
<span>
25+
{gradient.stops.map((stop, index) => (
26+
<Fragment key={index}>
27+
{stop.color.kind === "TokenLit" ? (
28+
<TokenLink id={stop.color.identifier} />
29+
) : (
30+
stop.color.value
31+
)}{" "}
32+
{(stop.position.value * 100).toFixed(1)}%{index < gradient.stops.length - 1 ? ", " : ""}
33+
</Fragment>
34+
))}
35+
</span>
36+
);
37+
}
38+
39+
function renderShadowWithTokens(shadow: AST.ShadowLit) {
40+
return (
41+
<span>
42+
{shadow.layers.map((layer, index) => (
43+
<Fragment key={index}>
44+
{layer.offsetX.value}
45+
{layer.offsetX.unit} {layer.offsetY.value}
46+
{layer.offsetY.unit} {layer.blur.value}
47+
{layer.blur.unit} {layer.spread.value}
48+
{layer.spread.unit}{" "}
49+
{layer.color.kind === "TokenLit" ? (
50+
<TokenLink id={layer.color.identifier} />
51+
) : (
52+
layer.color.value
53+
)}
54+
{index < shadow.layers.length - 1 ? ", " : ""}
55+
</Fragment>
56+
))}
57+
</span>
58+
);
59+
}
60+
2261
export function TokenCell(props: TokenCellProps) {
2362
const { isExpanded, values, resolvedValue } = props;
2463

64+
const isGradientWithTokens =
65+
resolvedValue.kind === "GradientLit" &&
66+
resolvedValue.stops.some((stop) => stop.color.kind === "TokenLit");
67+
68+
const isShadowWithTokens =
69+
resolvedValue.kind === "ShadowLit" &&
70+
resolvedValue.layers.some((layer) => layer.color.kind === "TokenLit");
71+
2572
return (
2673
<div className="flex justify-between" aria-expanded={isExpanded}>
2774
<div className="flex flex-col gap-1">
@@ -30,7 +77,11 @@ export function TokenCell(props: TokenCellProps) {
3077
<Fragment key={item.ref}>
3178
<div className="flex items-center gap-2">
3279
<TypeIndicator value={resolvedValue} />{" "}
33-
{item.ref.startsWith("$") ? (
80+
{index === values.length - 1 && isShadowWithTokens ? (
81+
renderShadowWithTokens(resolvedValue as AST.ShadowLit)
82+
) : index === values.length - 1 && isGradientWithTokens ? (
83+
renderGradientWithTokens(resolvedValue as AST.GradientLit)
84+
) : item.ref.startsWith("$") ? (
3485
<TokenLink id={item.ref} description={item.description} />
3586
) : (
3687
item.ref
@@ -46,7 +97,11 @@ export function TokenCell(props: TokenCellProps) {
4697
) : (
4798
<div className="flex items-center gap-2">
4899
<TypeIndicator value={resolvedValue} />{" "}
49-
{values[0].ref.startsWith("$") ? (
100+
{isShadowWithTokens ? (
101+
renderShadowWithTokens(resolvedValue as AST.ShadowLit)
102+
) : isGradientWithTokens ? (
103+
renderGradientWithTokens(resolvedValue as AST.GradientLit)
104+
) : values[0].ref.startsWith("$") ? (
50105
<TokenLink id={values[0].ref} description={values[0].description} />
51106
) : (
52107
values[0].ref

docs/components/type-indicator.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@ import { IconLayers, IconRuler, IconSpline } from "./icons";
55
// Gradient를 CSS linear-gradient로 변환하는 유틸리티 함수
66
function gradientToCss(gradient: AST.GradientLit): string {
77
const stops = gradient.stops
8-
.map((stop) => `${stop.color.value} ${(stop.position.value * 100).toFixed(1)}%`)
8+
.map((stop) => {
9+
const color =
10+
stop.color.kind === "ColorHexLit"
11+
? stop.color.value
12+
: `var(--seed-${stop.color.identifier.replace(/\$/g, "").replace(/\./g, "-")})`;
13+
return `${color} ${(stop.position.value * 100).toFixed(1)}%`;
14+
})
915
.join(", ");
1016
return `linear-gradient(to right, ${stops})`;
1117
}
1218

1319
// Gradient 정보를 텍스트로 변환하는 함수
1420
function gradientToText(gradient: AST.GradientLit): string {
1521
const stops = gradient.stops
16-
.map((stop) => `${stop.color.value} at ${(stop.position.value * 100).toFixed(1)}%`)
22+
.map((stop) => {
23+
const color = stop.color.kind === "ColorHexLit" ? stop.color.value : stop.color.identifier;
24+
return `${color} at ${(stop.position.value * 100).toFixed(1)}%`;
25+
})
1726
.join(", ");
1827
return `Gradient: ${stops}`;
1928
}

docs/content/docs/components/contextual-floating-button.mdx renamed to docs/content/docs/components/(buttons)/contextual-floating-button.mdx

docs/content/docs/components/floating-action-button.mdx renamed to docs/content/docs/components/(buttons)/floating-action-button.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"title": "Buttons",
3+
"defaultOpen": true
4+
}

0 commit comments

Comments
 (0)