Skip to content

Commit 46b37ce

Browse files
authored
Merge pull request #2708 from kev1n77/fmy/ui-sys
fix(ui): unify icon assets and usage across the design system and Web UI
2 parents 84b6fa9 + 5e4e8a9 commit 46b37ce

155 files changed

Lines changed: 1494 additions & 1057 deletions

File tree

Some content is hidden

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

design-system/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ pnpm run design-system:check
6161

6262
The Design Lab development entry uses source aliases for component HMR. Its production build consumes the public package exports, so authoring convenience cannot silently become the published contract.
6363

64+
Design Lab and Web UI also register `tooling/vite/watch-source.mjs` to watch
65+
the aliased UI source directory outside their application roots. Source aliases
66+
alone do not watch imported SVG assets: without this registration an icon edit
67+
can leave the previous inline asset module cached until the dev server restarts.
68+
6469
## Dependency direction
6570

6671
```text

design-system/apps/design-lab/src/App.tsx

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,13 @@ import {
66
} from "react";
77
import type { SystemTokenMode } from "@bitfun/design-tokens";
88
import type { ThemeDataName } from "@bitfun/theme-bitfun";
9-
import {
10-
AppWindow,
11-
Blocks,
12-
BookOpen,
13-
Braces,
14-
CircleDashed,
15-
FileText,
16-
House,
17-
Languages,
18-
Menu,
19-
Moon,
20-
MousePointerClick,
21-
Palette,
22-
PanelTop,
23-
PanelsTopLeft,
24-
Search,
25-
Settings2,
26-
SquareTerminal,
27-
Sun,
28-
ToggleLeft,
29-
X,
30-
type LucideIcon,
31-
} from "lucide-react";
32-
import {
9+
import { AppWindow, Blocks, BookOpen, Braces, CircleDashed, FileText, House, Languages, Menu, Moon, MousePointerClick, PanelTop, PanelsTopLeft, SquareTerminal, Sun, ToggleLeft, type LucideIcon } from "lucide-react";
10+
import { Icon as CatalogIcon,
3311
ThemeRoot,
3412
type ColorScheme,
3513
type ContrastMode,
3614
type DensityMode,
15+
type IconName,
3716
} from "@bitfun/ui";
3817
import { componentRegistry } from "@bitfun/ui/registry";
3918
import {
@@ -83,7 +62,7 @@ type LabRoute =
8362

8463
interface SearchDestination {
8564
detail: string;
86-
icon: LucideIcon;
65+
icon: LucideIcon | IconName;
8766
keywords: string;
8867
label: string;
8968
route: LabRoute;
@@ -209,7 +188,7 @@ export function App() {
209188
},
210189
{
211190
detail: t("search.colorsDetail", { count: colorTokenCatalog.length }),
212-
icon: Palette,
191+
icon: "palette",
213192
keywords: `colors semantic palette scale reference theme ${t("nav.colors")}`,
214193
label: t("nav.colors"),
215194
route: { page: "colors" },
@@ -404,7 +383,7 @@ export function App() {
404383
<strong>BitFun Design</strong>
405384
</span>
406385
<button aria-label={t("app.closeNavigation")} onClick={() => setSidebarOpen(false)} type="button">
407-
<X aria-hidden="true" size={18} />
386+
<CatalogIcon name="xmark" size="lg" aria-hidden="true" style={{ width: 18, height: 18 }} />
408387
</button>
409388
</div>
410389

@@ -453,7 +432,7 @@ export function App() {
453432
navigate({ page: "colors" });
454433
}}
455434
>
456-
<Palette aria-hidden="true" size={17} />
435+
<CatalogIcon name="palette" size="md" style={{ width: 17, height: 17 }} aria-hidden="true" />
457436
<span>{t("nav.colors")}</span>
458437
<small>{colorTokenCatalog.length}</small>
459438
</a>
@@ -547,7 +526,7 @@ export function App() {
547526
type="button"
548527
>
549528
{t(`settings.${density}` as MessageKey)}
550-
<Settings2 aria-hidden="true" size={13} />
529+
<CatalogIcon name="settings" size="sm" style={{ width: 13, height: 13 }} aria-hidden="true" />
551530
</button>
552531
</div>
553532
</aside>
@@ -564,7 +543,7 @@ export function App() {
564543
</button>
565544

566545
<div className="lab-search">
567-
<Search aria-hidden="true" size={17} />
546+
<CatalogIcon name="search" size="lg" aria-hidden="true" style={{ width: 17, height: 17 }} />
568547
<input
569548
aria-autocomplete="list"
570549
aria-controls="lab-search-results"
@@ -594,7 +573,7 @@ export function App() {
594573
role="option"
595574
type="button"
596575
>
597-
<span><Icon aria-hidden="true" size={16} /></span>
576+
<span>{typeof Icon === "string" ? <CatalogIcon name={Icon} size="md" /> : <Icon aria-hidden="true" size={16} />}</span>
598577
<span>
599578
<strong>{destination.label}</strong>
600579
<small>{destination.detail}</small>
@@ -655,7 +634,7 @@ export function App() {
655634
onClick={() => setSettingsOpen((current) => !current)}
656635
type="button"
657636
>
658-
<Settings2 aria-hidden="true" size={18} />
637+
<CatalogIcon name="settings" size="lg" style={{ width: 18, height: 18 }} aria-hidden="true" />
659638
</button>
660639
{settingsOpen && (
661640
<div className="lab-settings-panel" id="lab-settings-panel">
@@ -665,7 +644,7 @@ export function App() {
665644
<span>{t("settings.subtitle")}</span>
666645
</div>
667646
<button aria-label={t("settings.close")} onClick={() => setSettingsOpen(false)} type="button">
668-
<X aria-hidden="true" size={16} />
647+
<CatalogIcon name="xmark" size="md" aria-hidden="true" />
669648
</button>
670649
</div>
671650
<label>

design-system/apps/design-lab/src/pages/ColorsPage.tsx

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
import { Fragment, useMemo, useState, type CSSProperties } from "react";
2-
import {
3-
ChevronDown,
4-
ChevronRight,
5-
Contrast,
6-
LayoutGrid,
7-
Moon,
8-
Search,
9-
Sun,
10-
} from "lucide-react";
11-
import type { DensityMode } from "@bitfun/ui";
2+
import { Contrast, LayoutGrid, Moon, Sun } from "lucide-react";
3+
import { Icon, type DensityMode } from "@bitfun/ui";
124
import {
135
themeContractVersion,
146
themeTokenCatalog,
@@ -226,7 +218,7 @@ export function ColorsPage({
226218
<main className="lab-page lab-page--colors" id="colors">
227219
<nav aria-label={t("colors.breadcrumbLabel")} className="colors-breadcrumb">
228220
<span>{t("nav.foundations")}</span>
229-
<ChevronRight aria-hidden="true" size={14} />
221+
<Icon name="chevron-right" size="sm" aria-hidden="true" />
230222
<strong>Colors</strong>
231223
</nav>
232224

@@ -249,7 +241,7 @@ export function ColorsPage({
249241
{t("colors.themeName", { version: themeContractVersion })}
250242
</option>
251243
</select>
252-
<ChevronDown aria-hidden="true" size={15} />
244+
<Icon name="chevron-down" size="lg" aria-hidden="true" style={{ width: 15, height: 15 }} />
253245
</span>
254246
</label>
255247

@@ -266,7 +258,7 @@ export function ColorsPage({
266258
<option key={value} value={value}>{t(label)}</option>
267259
))}
268260
</select>
269-
<ChevronDown aria-hidden="true" size={15} />
261+
<Icon name="chevron-down" size="lg" aria-hidden="true" style={{ width: 15, height: 15 }} />
270262
</span>
271263
</label>
272264

@@ -283,7 +275,7 @@ export function ColorsPage({
283275
<option value="comfortable">{t("settings.comfortable")}</option>
284276
<option value="touch">{t("settings.touch")}</option>
285277
</select>
286-
<ChevronDown aria-hidden="true" size={15} />
278+
<Icon name="chevron-down" size="lg" aria-hidden="true" style={{ width: 15, height: 15 }} />
287279
</span>
288280
</label>
289281
</div>
@@ -309,7 +301,7 @@ export function ColorsPage({
309301
<h2>{t("colors.semantic.title")}</h2>
310302
<div className="colors-semantic-tools">
311303
<label className="colors-search-field">
312-
<Search aria-hidden="true" size={16} />
304+
<Icon name="search" size="md" aria-hidden="true" />
313305
<input
314306
aria-label={t("colors.semantic.searchLabel")}
315307
onChange={(event) => setQuery(event.target.value)}
@@ -329,7 +321,7 @@ export function ColorsPage({
329321
<option key={group} value={group}>{t(groupLabelKeys[group])}</option>
330322
))}
331323
</select>
332-
<ChevronDown aria-hidden="true" size={15} />
324+
<Icon name="chevron-down" size="lg" aria-hidden="true" style={{ width: 15, height: 15 }} />
333325
</label>
334326
</div>
335327
</header>
@@ -403,7 +395,7 @@ export function ColorsPage({
403395
type="button"
404396
>
405397
{expanded ? t("colors.collapse") : t("colors.expand")}
406-
<ChevronDown aria-hidden="true" data-expanded={expanded || undefined} size={15} />
398+
<Icon name="chevron-down" size="lg" aria-hidden="true" data-expanded={expanded || undefined} style={{ width: 15, height: 15 }} />
407399
</button>
408400
)}
409401
</section>
@@ -425,7 +417,7 @@ export function ColorsPage({
425417
</option>
426418
))}
427419
</select>
428-
<ChevronDown aria-hidden="true" size={15} />
420+
<Icon name="chevron-down" size="lg" aria-hidden="true" style={{ width: 15, height: 15 }} />
429421
</span>
430422
</label>
431423
</header>

0 commit comments

Comments
 (0)