Skip to content

Commit 1513754

Browse files
committed
feat: add gallery preview cards, typography controls and styling system
This commit implements a full gallery preview showcase with multiple component cards, adds typography customization controls, refactors color token types, and updates the workspace preview to use dynamic styling based on user controls: 1. Adds 4 preview cards: budget table, draft status table, source share bar chart, and performance area chart 2. Creates a reusable gallery preview card export array 3. Adds typography system with font family, base size, and line height controls 4. Refactors color token default types into a reusable GalleryColorTokenValues type 5. Adds spacing customization controls to the editor 6. Updates card UI components to use dynamic typography and spacing variables 7. Reworks workspace preview to use dynamic theme values from user settings 8. Passes all new state and props through the app sidebar and panel components
1 parent 325ff50 commit 1513754

14 files changed

Lines changed: 970 additions & 388 deletions

apps/agent-html/.agent-html-dev.out

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,30 @@ Port 4173 is in use, trying another one...
159159
5:35:19 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
160160
5:39:51 PM [vite] (client) hmr update /src/components/app-sidebar.tsx, /src/index.css
161161
5:39:58 PM [vite] (client) hmr update /src/index.css, /src/gallery/editor.tsx
162+
5:41:13 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
163+
5:43:17 PM [vite] (client) hmr update /src/index.css, /src/gallery/editor.tsx
164+
5:43:30 PM [vite] (client) hmr update /src/App.tsx, /src/index.css
165+
5:43:45 PM [vite] (client) hmr update /src/components/app-sidebar.tsx, /src/index.css
166+
5:43:53 PM [vite] (client) hmr update /src/index.css, /src/gallery/panel.tsx
167+
5:44:03 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
168+
5:44:15 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
169+
5:45:43 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
170+
5:49:57 PM [vite] (client) hmr update /src/index.css, /src/gallery/editor.tsx
171+
5:50:10 PM [vite] (client) hmr update /src/index.css, /src/gallery/editor.tsx
172+
5:50:24 PM [vite] (client) hmr update /src/App.tsx, /src/index.css
173+
5:50:38 PM [vite] (client) hmr update /src/components/app-sidebar.tsx, /src/index.css
174+
5:50:50 PM [vite] (client) hmr update /src/index.css, /src/gallery/panel.tsx
175+
5:51:14 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
176+
5:51:44 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
177+
5:52:06 PM [vite] (client) hmr update /src/index.css, /src/gallery/editor.tsx
178+
5:57:36 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
179+
5:57:57 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
180+
5:57:57 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
181+
6:00:46 PM [vite] (client) hmr update /src/App.tsx, /src/index.css
182+
6:01:27 PM [vite] (client) hmr update /src/components/app-sidebar.tsx, /src/index.css
183+
6:02:07 PM [vite] (client) hmr update /src/index.css, /src/gallery/editor.tsx
184+
6:02:24 PM [vite] (client) hmr update /src/index.css, /src/gallery/panel.tsx
185+
6:02:39 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
186+
6:02:39 PM [vite] (client) hmr update /src/index.css, /src/gallery/workspace-preview.tsx
187+
6:03:17 PM [vite] (client) hmr update /src/index.css, /src/gallery/ui/card.tsx
188+
6:03:51 PM [vite] (client) hmr update /src/index.css, /src/gallery/editor.tsx

apps/agent-html/src/App.tsx

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import * as React from "react"
22

3-
import type { GalleryRadiusValue } from "@/gallery/editor"
3+
import type {
4+
GalleryRadiusValue,
5+
GallerySpacingValue,
6+
} from "@/gallery/editor"
7+
import {
8+
galleryColorTokenDefaults,
9+
type GalleryColorTokenName,
10+
type GalleryColorTokenValue,
11+
} from "@/gallery/editor-panels"
412
import { galleryScenes } from "@/gallery/scenes"
13+
import {
14+
galleryTypographyDefaults,
15+
type GalleryTypographyValue,
16+
} from "@/gallery/typography"
517
import type { GalleryEditorMode } from "@/gallery/types"
618
import { GalleryPanel } from "@/gallery/panel"
719
import { galleryWorkspacePreviewBaseSceneId } from "@/gallery/preview-content"
@@ -237,8 +249,15 @@ export function App() {
237249
const [surfaceMode, setSurfaceMode] = React.useState<SurfaceMode>("workspace")
238250
const [galleryEditorMode, setGalleryEditorMode] =
239251
React.useState<GalleryEditorMode>("color")
252+
const [galleryColorTokenValues, setGalleryColorTokenValues] = React.useState(
253+
galleryColorTokenDefaults
254+
)
255+
const [galleryTypographyValue, setGalleryTypographyValue] =
256+
React.useState<GalleryTypographyValue>(galleryTypographyDefaults)
240257
const [galleryRadiusValue, setGalleryRadiusValue] =
241258
React.useState<GalleryRadiusValue>("0.625rem")
259+
const [gallerySpacingValue, setGallerySpacingValue] =
260+
React.useState<GallerySpacingValue>("1rem")
242261
const [activeGallerySceneId, setActiveGallerySceneId] = React.useState<string>(
243262
galleryScenes[0].id
244263
)
@@ -435,25 +454,42 @@ export function App() {
435454
/>
436455
<main className="flex min-h-0 flex-1 overflow-hidden">
437456
<AppSidebar
457+
galleryColorTokenValues={galleryColorTokenValues}
438458
galleryEditorMode={galleryEditorMode}
439459
galleryRadiusValue={galleryRadiusValue}
460+
gallerySpacingValue={gallerySpacingValue}
461+
galleryTypographyValue={galleryTypographyValue}
440462
mode={surfaceMode}
441463
onDeleteProject={handleDeleteProject}
442464
onDuplicateProject={handleDuplicateProject}
443465
onEnterGalleryMode={handleEnterGalleryMode}
444466
onExitGalleryMode={handleExitGalleryMode}
467+
onGalleryColorTokenValueChange={(
468+
token: GalleryColorTokenName,
469+
value: GalleryColorTokenValue
470+
) =>
471+
setGalleryColorTokenValues((current) => ({
472+
...current,
473+
[token]: value,
474+
}))
475+
}
445476
onGalleryEditorModeChange={setGalleryEditorMode}
446477
onOpenProject={handleOpenProject}
447478
onRadiusChange={setGalleryRadiusValue}
479+
onSpacingChange={setGallerySpacingValue}
480+
onTypographyChange={setGalleryTypographyValue}
448481
onRenameProject={handleRenameProject}
449482
projects={projects}
450483
variant="inset"
451484
/>
452485
<SidebarInset className="min-h-0 overflow-hidden border-0 shadow-sm md:mr-2 md:mb-2">
453486
{surfaceMode === "gallery" ? (
454487
<GalleryPanel
488+
colorTokenValues={galleryColorTokenValues}
455489
radiusValue={galleryRadiusValue}
456490
scene={galleryDisplayScene}
491+
spacingValue={gallerySpacingValue}
492+
typographyValue={galleryTypographyValue}
457493
/>
458494
) : (
459495
<WorkspacePanel activeProject={activeProject} />

apps/agent-html/src/components/app-sidebar.tsx

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import * as React from "react"
22

3-
import { GalleryEditorPanel, type GalleryRadiusValue } from "@/gallery/editor"
3+
import {
4+
GalleryEditorPanel,
5+
type GalleryRadiusValue,
6+
type GallerySpacingValue,
7+
} from "@/gallery/editor"
8+
import type {
9+
GalleryColorTokenName,
10+
GalleryColorTokenValue,
11+
GalleryColorTokenValues,
12+
} from "@/gallery/editor-panels"
13+
import type { GalleryTypographyValue } from "@/gallery/typography"
414
import type { GalleryEditorMode } from "@/gallery/types"
515
import {
616
Popover,
@@ -35,30 +45,45 @@ const galleryHeaderEditorItems = [
3545
] as const
3646

3747
export function AppSidebar({
48+
galleryColorTokenValues,
3849
mode = "workspace",
3950
onEnterGalleryMode,
4051
onExitGalleryMode,
4152
onDeleteProject,
4253
onDuplicateProject,
54+
onGalleryColorTokenValueChange,
4355
onGalleryEditorModeChange,
4456
onOpenProject,
4557
onRadiusChange,
58+
onSpacingChange,
59+
onTypographyChange,
4660
onRenameProject,
4761
projects,
4862
galleryEditorMode = "color",
4963
galleryRadiusValue = "0.625rem",
64+
gallerySpacingValue = "1rem",
65+
galleryTypographyValue,
5066
...props
5167
}: React.ComponentProps<typeof Sidebar> & {
68+
galleryColorTokenValues: GalleryColorTokenValues
5269
galleryEditorMode?: GalleryEditorMode
5370
galleryRadiusValue?: GalleryRadiusValue
71+
gallerySpacingValue?: GallerySpacingValue
72+
galleryTypographyValue: GalleryTypographyValue
5473
mode?: "gallery" | "workspace"
5574
onEnterGalleryMode?: () => void
5675
onExitGalleryMode?: () => void
5776
onDeleteProject: (projectId: string) => void
5877
onDuplicateProject: (projectId: string) => void
78+
onGalleryColorTokenValueChange: (
79+
token: GalleryColorTokenName,
80+
value: GalleryColorTokenValue
81+
) => void
5982
onGalleryEditorModeChange?: (mode: GalleryEditorMode) => void
6083
onOpenProject: (projectId: string) => void
6184
onRadiusChange?: (value: GalleryRadiusValue) => void
85+
onSpacingChange?: (value: GallerySpacingValue) => void
86+
onTypographyChange: (value: GalleryTypographyValue) => void
6287
onRenameProject: (projectId: string, name: string) => void
6388
projects: ProjectNavItem[]
6489
}) {
@@ -138,9 +163,15 @@ export function AppSidebar({
138163
<SidebarContent>
139164
{isGalleryMode ? (
140165
<GalleryEditorPanel
166+
colorTokenValues={galleryColorTokenValues}
141167
mode={galleryEditorMode}
168+
onColorTokenValueChange={onGalleryColorTokenValueChange}
142169
onRadiusChange={(value) => onRadiusChange?.(value)}
170+
onSpacingChange={(value) => onSpacingChange?.(value)}
171+
onTypographyChange={onTypographyChange}
143172
radiusValue={galleryRadiusValue}
173+
spacingValue={gallerySpacingValue}
174+
typographyValue={galleryTypographyValue}
144175
/>
145176
) : (
146177
<NavProjects

apps/agent-html/src/gallery/editor-panels.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ export type GalleryColorTokenValue = {
5050
step: GalleryColorStep
5151
}
5252

53+
export type GalleryColorTokenValues = Record<
54+
GalleryColorTokenName,
55+
GalleryColorTokenValue
56+
>
57+
5358
export const galleryColorRoleGroups: ColorRoleGroup[] = [
5459
{
5560
id: "base-surfaces",
@@ -83,10 +88,7 @@ export const galleryColorRoleGroups: ColorRoleGroup[] = [
8388
},
8489
]
8590

86-
export const galleryColorTokenDefaults: Record<
87-
GalleryColorTokenName,
88-
GalleryColorTokenValue
89-
> = {
91+
export const galleryColorTokenDefaults: GalleryColorTokenValues = {
9092
background: { family: "zinc", step: "50" },
9193
foreground: { family: "zinc", step: "900" },
9294
card: { family: "zinc", step: "50" },

0 commit comments

Comments
 (0)