Skip to content

Commit 53e582f

Browse files
miguel-heygenclaude
andcommitted
feat(studio): add collapsible sections to Design panel
Section component now supports collapse/expand with a chevron toggle. Text, Layout, and Fill sections stay expanded by default. Less-used sections (Flex, Radius, Stroke, Effects, Clip, Transparency) start collapsed to reduce scrolling. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b776d48 commit 53e582f

2 files changed

Lines changed: 30 additions & 11 deletions

File tree

packages/studio/src/components/editor/propertyPanelPrimitives.tsx

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,24 +334,43 @@ export function Section({
334334
icon,
335335
children,
336336
accessory,
337+
defaultCollapsed = false,
337338
}: {
338339
title: string;
339340
icon: ReactNode;
340341
children: ReactNode;
341342
accessory?: ReactNode;
343+
defaultCollapsed?: boolean;
342344
}) {
345+
const [collapsed, setCollapsed] = useState(defaultCollapsed);
346+
343347
return (
344-
<section className="min-w-0 border-t border-neutral-800/80 px-4 py-4">
345-
<div className="mb-3 flex min-w-0 flex-wrap items-center justify-between gap-2">
348+
<section className="min-w-0 border-t border-neutral-800/80">
349+
<button
350+
type="button"
351+
onClick={() => setCollapsed((v) => !v)}
352+
className="flex w-full items-center justify-between gap-2 px-4 py-3"
353+
>
346354
<div className="flex min-w-0 items-center gap-2.5">
347355
<span className="flex-shrink-0 text-neutral-500">{icon}</span>
348356
<h3 className="text-[11px] font-semibold uppercase tracking-[0.12em] text-neutral-300">
349357
{title}
350358
</h3>
351359
</div>
352-
{accessory}
353-
</div>
354-
{children}
360+
<div className="flex items-center gap-2">
361+
{accessory}
362+
<svg
363+
width="10"
364+
height="10"
365+
viewBox="0 0 10 10"
366+
fill="currentColor"
367+
className={`flex-shrink-0 text-neutral-500 transition-transform ${collapsed ? "-rotate-90" : ""}`}
368+
>
369+
<path d="M2 3l3 4 3-4z" />
370+
</svg>
371+
</div>
372+
</button>
373+
{!collapsed && <div className="px-4 pb-4">{children}</div>}
355374
</section>
356375
);
357376
}

packages/studio/src/components/editor/propertyPanelStyleSections.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export function StyleSections({
109109
return (
110110
<>
111111
{isFlex && (
112-
<Section title="Flex" icon={<Layers size={15} />}>
112+
<Section title="Flex" icon={<Layers size={15} />} defaultCollapsed>
113113
<div className="space-y-4">
114114
<SegmentedControl
115115
disabled={styleEditingDisabled}
@@ -154,7 +154,7 @@ export function StyleSections({
154154
)}
155155

156156
{hasVisualBackground && (
157-
<Section title="Radius" icon={<Settings size={15} />}>
157+
<Section title="Radius" icon={<Settings size={15} />} defaultCollapsed>
158158
<SliderControl
159159
value={radiusValue}
160160
min={0}
@@ -168,7 +168,7 @@ export function StyleSections({
168168
</Section>
169169
)}
170170

171-
<Section title="Stroke" icon={<Square size={15} />}>
171+
<Section title="Stroke" icon={<Square size={15} />} defaultCollapsed>
172172
<div className="space-y-4">
173173
<div className={RESPONSIVE_GRID}>
174174
<MetricField
@@ -226,7 +226,7 @@ export function StyleSections({
226226
</div>
227227
</Section>
228228

229-
<Section title="Effects" icon={<Zap size={15} />}>
229+
<Section title="Effects" icon={<Zap size={15} />} defaultCollapsed>
230230
<div className="space-y-4">
231231
<SelectField
232232
label="Shadow"
@@ -279,7 +279,7 @@ export function StyleSections({
279279
</div>
280280
</Section>
281281

282-
<Section title="Clip" icon={<Layers size={15} />}>
282+
<Section title="Clip" icon={<Layers size={15} />} defaultCollapsed>
283283
<div className="space-y-4">
284284
<div className={RESPONSIVE_GRID}>
285285
<SelectField
@@ -325,7 +325,7 @@ export function StyleSections({
325325
</div>
326326
</Section>
327327

328-
<Section title="Transparency" icon={<Eye size={15} />}>
328+
<Section title="Transparency" icon={<Eye size={15} />} defaultCollapsed>
329329
<div className="space-y-4">
330330
<SliderControl
331331
value={opacityValue}

0 commit comments

Comments
 (0)