Skip to content

Commit b93cdf0

Browse files
committed
Version-aware icons page, add Material Symbols class for v0.9
- Icons page renders with correct renderer based on spec version toggle - Add .material-symbols-outlined CSS class in globals.css — the v0.9 Icon component uses this class but Google Fonts only provides @font-face rules, not the class definition - Includes overflow: hidden to prevent icon name text from overflowing during font load
1 parent c0e2e37 commit b93cdf0

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed

tools/composer/src/app/globals.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,25 @@
223223
--s-0: #000000;
224224
}
225225

226+
/* Material Symbols class for v0.9 renderer.
227+
* The v0.9 Icon component uses className="material-symbols-outlined"
228+
* but Google Fonts only defines @font-face rules, not the CSS class. */
229+
.material-symbols-outlined {
230+
font-family: 'Material Symbols Outlined';
231+
font-weight: normal;
232+
font-style: normal;
233+
font-size: 24px;
234+
line-height: 1;
235+
letter-spacing: normal;
236+
text-transform: none;
237+
display: inline-block;
238+
white-space: nowrap;
239+
word-wrap: normal;
240+
direction: ltr;
241+
-webkit-font-smoothing: antialiased;
242+
overflow: hidden;
243+
}
244+
226245
/* Monaco editor - use background highlight instead of border */
227246
.monaco-editor .current-line,
228247
.monaco-editor .view-overlays .current-line {

tools/composer/src/app/icons/page.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import { useState } from 'react';
2020
import { cn } from '@/lib/utils';
2121
import { ExternalLink, Copy, Check } from 'lucide-react';
2222
import { A2UIViewer } from '@/lib/a2ui';
23+
import { useSpecVersion } from '@/contexts/spec-version-context';
24+
import type { A2UIComponent, SpecVersion } from '@/types/widget';
2325

2426
// 100 most important Material Icons for common UI patterns
2527
const MATERIAL_ICONS = [
@@ -66,7 +68,14 @@ const MATERIAL_ICONS = [
6668
'dashboard', 'list', 'view_list', 'grid_view', 'table_chart', 'bar_chart',
6769
];
6870

69-
function IconCard({ name, isSelected, onClick }: { name: string; isSelected: boolean; onClick: () => void }) {
71+
function iconComponent(name: string, specVersion: SpecVersion): A2UIComponent[] {
72+
if (specVersion === '0.9') {
73+
return [{ id: 'icon', component: 'Icon', name }];
74+
}
75+
return [{ id: 'icon', component: { Icon: { name: { literalString: name } } } }];
76+
}
77+
78+
function IconCard({ name, isSelected, onClick, specVersion }: { name: string; isSelected: boolean; onClick: () => void; specVersion: SpecVersion }) {
7079
return (
7180
<button
7281
onClick={onClick}
@@ -80,16 +89,8 @@ function IconCard({ name, isSelected, onClick }: { name: string; isSelected: boo
8089
<div className="flex h-12 w-12 items-center justify-center scale-[2]">
8190
<A2UIViewer
8291
root="icon"
83-
components={[
84-
{
85-
id: 'icon',
86-
component: {
87-
Icon: {
88-
name: { literalString: name },
89-
},
90-
},
91-
},
92-
]}
92+
components={iconComponent(name, specVersion)}
93+
specVersion={specVersion}
9394
/>
9495
</div>
9596
<span className="text-xs text-muted-foreground truncate w-full text-center">
@@ -100,6 +101,7 @@ function IconCard({ name, isSelected, onClick }: { name: string; isSelected: boo
100101
}
101102

102103
export default function IconsPage() {
104+
const { specVersion } = useSpecVersion();
103105
const [selectedIcon, setSelectedIcon] = useState<string | null>(null);
104106
const [copied, setCopied] = useState(false);
105107

@@ -156,6 +158,7 @@ export default function IconsPage() {
156158
name={name}
157159
isSelected={selectedIcon === name}
158160
onClick={() => setSelectedIcon(name)}
161+
specVersion={specVersion}
159162
/>
160163
))}
161164
</div>

0 commit comments

Comments
 (0)