feat(client): add UI kit, data layer, app shell, and Table component
- design token system (Atlantis, Kimberly, Powder Ash palette) - Button, Badge, Input, Select, Card, SidePanel, Breadcrumbs components - generic typed Table<T> component with loading/empty states - API data layer: typed fetch client for environments, keys, sessions, scenarios - Vite dev proxy targeting server on port 13000 - App shell with SidePanel nav and four entity pages (Environments, Keys, Sessions, Scenarios) - Storybook config with dark/light theme toggle and a11y addon
This commit is contained in:
1 parent
5cc16725fb
commit
9916ef5aaf
47 files changed
+3910
-10
No files matched your search
@@ -0,0 +1,68 @@
|
||||
import React, { useState } from 'react';
|
||||
import styles from './SidePanel.module.css';
|
||||
|
||||
export interface SidePanelProps {
|
||||
children: React.ReactNode;
|
||||
header?: React.ReactNode;
|
||||
width?: number;
|
||||
defaultCollapsed?: boolean;
|
||||
collapsed?: boolean;
|
||||
onCollapsedChange?: (collapsed: boolean) => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function SidePanel({
|
||||
children,
|
||||
header,
|
||||
width = 240,
|
||||
defaultCollapsed = false,
|
||||
collapsed: controlledCollapsed,
|
||||
onCollapsedChange,
|
||||
className,
|
||||
}: SidePanelProps) {
|
||||
const [internalCollapsed, setInternalCollapsed] = useState(defaultCollapsed);
|
||||
const isControlled = controlledCollapsed !== undefined;
|
||||
const collapsed = isControlled ? controlledCollapsed : internalCollapsed;
|
||||
|
||||
function toggle() {
|
||||
const next = !collapsed;
|
||||
if (!isControlled) setInternalCollapsed(next);
|
||||
onCollapsedChange?.(next);
|
||||
}
|
||||
|
||||
return (
|
||||
<aside
|
||||
className={[styles.panel, collapsed ? styles.collapsed : '', className].filter(Boolean).join(' ')}
|
||||
style={{ '--side-panel-width': `${width}px` } as React.CSSProperties}
|
||||
aria-expanded={!collapsed}
|
||||
>
|
||||
<div className={styles.inner}>
|
||||
{header && <div className={styles.header}>{header}</div>}
|
||||
<div className={styles.content}>{children}</div>
|
||||
</div>
|
||||
<button
|
||||
className={styles.toggle}
|
||||
onClick={toggle}
|
||||
aria-label={collapsed ? 'Expand panel' : 'Collapse panel'}
|
||||
title={collapsed ? 'Expand' : 'Collapse'}
|
||||
>
|
||||
<svg
|
||||
className={styles.chevron}
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 16 16"
|
||||
fill="none"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
d="M6 3L11 8L6 13"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user