mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-04 22:21:21 +09:00
Phase 0 of the ServerKit UI redesign (see docs/REDESIGN_MAP.md): - Remap design tokens to the new infra-console palette behind existing names; add prototype token names (surface ramp, cyan/violet, accent-bright/-bg). Dark/light/system. - Self-host IBM Plex (woff2 vendored via scripts/fetch-fonts.mjs); no Google Fonts CDN. - Runtime-derive the full accent ramp in ThemeContext. - Add shared design-system primitives in components/ds (Pill, EnvTag, SegControl, MetricCard, Gauge, ServiceTile, Sparkline, AreaChart, ScoreGauge, Feed, Drawer). - Restyle the sidebar (gradient rail, mono section headers, left accent bar) and switch the brand to the demo's gradient-tile logo. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
28 lines
1.0 KiB
React
28 lines
1.0 KiB
React
import { cn } from '@/lib/utils';
|
|
|
|
// Segmented toggle. Replaces native <select> / filter-chip clusters.
|
|
// options: array of strings, or { value, label, icon?, count? } objects.
|
|
export function SegControl({ options = [], value, onChange, className, ...props }) {
|
|
const items = options.map((o) => (typeof o === 'string' ? { value: o, label: o } : o));
|
|
return (
|
|
<div className={cn('sk-seg', className)} role="tablist" {...props}>
|
|
{items.map((o) => (
|
|
<button
|
|
key={o.value}
|
|
type="button"
|
|
role="tab"
|
|
aria-selected={value === o.value}
|
|
className={cn('sk-seg__btn', value === o.value && 'is-on')}
|
|
onClick={() => onChange?.(o.value)}
|
|
>
|
|
{o.icon}
|
|
{o.label}
|
|
{o.count != null && <span className="sk-seg__count">{o.count}</span>}
|
|
</button>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default SegControl;
|