diff --git a/src/app/components/LivePreview.module.css b/src/app/components/LivePreview.module.css index 7754e60..f154807 100644 --- a/src/app/components/LivePreview.module.css +++ b/src/app/components/LivePreview.module.css @@ -25,41 +25,8 @@ box-sizing: border-box; } -/* Segmented control — the four fit modes (spec §04). */ -.fit { - display: inline-flex; - border: var(--border-width) solid var(--border-strong); -} - -.fitOption { - appearance: none; - border: none; - background: var(--bg); - color: var(--text-secondary); - font: inherit; - font-size: 12px; - line-height: 1; - padding: var(--space-2) var(--space-3); - cursor: pointer; - transition: - background var(--dur-fast) var(--ease), - color var(--dur-fast) var(--ease); -} - -.fitOption + .fitOption { - border-left: var(--border-width) solid var(--border-strong); -} - -.fitOption:hover { - background: var(--layer-01); - color: var(--text); -} - -.fitActive, -.fitActive:hover { - background: var(--accent); - color: var(--accent-contrast); -} +/* Fit-mode segmented control (spec §04) styling now lives in + SegmentedControl.module.css; the per-mode sizing classes below stay here. */ /* * Chart sizing. The host (passed to vega-embed) is branded `.vega-embed` diff --git a/src/app/components/LivePreview.tsx b/src/app/components/LivePreview.tsx index 5953af2..462de5a 100644 --- a/src/app/components/LivePreview.tsx +++ b/src/app/components/LivePreview.tsx @@ -62,9 +62,6 @@ function FitControl() { options={FIT_OPTIONS} value={fitMode} onChange={setFitMode} - className={styles.fit} - optionClassName={styles.fitOption} - activeClassName={styles.fitActive} /> ); } diff --git a/src/app/components/SegmentedControl.module.css b/src/app/components/SegmentedControl.module.css new file mode 100644 index 0000000..1006e43 --- /dev/null +++ b/src/app/components/SegmentedControl.module.css @@ -0,0 +1,42 @@ +/* + * Shared look for every SegmentedControl. The control's appearance is owned here + * — once — so the Draft/Published and fit-mode instances can't drift apart again. + * Selected option uses --layer-02 (a neutral high-contrast fill, per Carbon's + * content switcher); --accent stays reserved for primary actions (e.g. Publish), + * so "current selection" never reads as "the action to take". Call sites may still + * pass className/optionClassName/activeClassName for layout-specific additions. + */ +.group { + display: inline-flex; + border: var(--border-width) solid var(--border-strong); +} + +.option { + appearance: none; + border: none; + background: var(--bg); + color: var(--text-secondary); + font: inherit; + font-size: 12px; + line-height: 1; + padding: var(--space-2) var(--space-3); + cursor: pointer; + transition: + background var(--dur-fast) var(--ease), + color var(--dur-fast) var(--ease); +} + +.option + .option { + border-left: var(--border-width) solid var(--border-strong); +} + +.option:hover { + background: var(--layer-01); + color: var(--text); +} + +.active, +.active:hover { + background: var(--layer-02); + color: var(--text); +} diff --git a/src/app/components/SegmentedControl.tsx b/src/app/components/SegmentedControl.tsx index c9479f3..b725b16 100644 --- a/src/app/components/SegmentedControl.tsx +++ b/src/app/components/SegmentedControl.tsx @@ -9,10 +9,13 @@ * move focus *and* select. Native `