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:
ars9 committed 2026-04-09 00:11:55 +03:00
1 parent 5cc16725fb
commit 9916ef5aaf
47 files changed
+3910 -10

No files matched your search

@@ -0,0 +1,88 @@
.panel {
position: relative;
display: flex;
flex-shrink: 0;
width: var(--side-panel-width, 240px);
background: var(--color-bg-subtle);
border-right: var(--border-width) solid var(--color-border);
font-family: var(--font-family);
transition: width 220ms ease;
overflow: visible;
}
.panel.collapsed {
width: 0;
}
.inner {
width: var(--side-panel-width, 240px);
display: flex;
flex-direction: column;
overflow: hidden;
min-height: 0;
flex: 1;
transition: opacity 180ms ease;
}
.collapsed .inner {
opacity: 0;
pointer-events: none;
}
.header {
padding: var(--space-4) var(--space-4) var(--space-3);
border-bottom: var(--border-width) solid var(--color-border);
font-weight: 600;
font-size: var(--font-size-sm);
color: var(--color-text);
flex-shrink: 0;
}
.content {
flex: 1;
overflow-y: auto;
padding: var(--space-3) var(--space-2);
}
/* ── Toggle button ───────────────────────────────────────── */
.toggle {
position: absolute;
top: var(--space-5);
right: -14px;
z-index: 10;
width: 28px;
height: 28px;
border-radius: var(--radius-full);
background: var(--color-bg);
border: var(--border-width) solid var(--color-border);
color: var(--color-text-muted);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: var(--shadow-sm);
transition: background var(--transition), color var(--transition);
flex-shrink: 0;
}
.toggle:hover {
background: var(--color-secondary);
color: var(--color-secondary-fg);
border-color: var(--color-secondary-border);
}
.toggle:focus-visible {
outline: 2px solid var(--color-primary);
outline-offset: 2px;
}
/* ── Chevron rotation ────────────────────────────────────── */
.chevron {
transition: transform 220ms ease;
/* Points right (→) by default = collapse direction */
}
.collapsed .chevron {
transform: rotate(180deg);
/* Points left (←) = expand direction */
}
@@ -0,0 +1,83 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { SidePanel } from './SidePanel';
const NAV_ITEMS = ['Dashboard', 'Scenarios', 'Environments', 'Reports', 'Settings'];
function NavList() {
return (
<ul style={{ listStyle: 'none', margin: 0, padding: 0, display: 'flex', flexDirection: 'column', gap: 2 }}>
{NAV_ITEMS.map((item) => (
<li key={item}>
<button
style={{
width: '100%',
textAlign: 'left',
background: 'none',
border: 'none',
borderRadius: 'var(--radius-md)',
padding: 'var(--space-2) var(--space-3)',
fontSize: 'var(--font-size-sm)',
color: 'var(--color-text)',
cursor: 'pointer',
fontFamily: 'var(--font-family)',
}}
onMouseEnter={(e) => (e.currentTarget.style.background = 'var(--color-secondary)')}
onMouseLeave={(e) => (e.currentTarget.style.background = 'none')}
>
{item}
</button>
</li>
))}
</ul>
);
}
const meta: Meta<typeof SidePanel> = {
title: 'UI/SidePanel',
component: SidePanel,
parameters: { layout: 'fullscreen' },
tags: ['autodocs'],
decorators: [
(Story) => (
<div style={{ display: 'flex', height: 420, background: 'var(--color-bg)' }}>
<Story />
<div style={{ flex: 1, padding: 'var(--space-6)', color: 'var(--color-text-muted)', fontSize: 'var(--font-size-sm)' }}>
Main content area
</div>
</div>
),
],
};
export default meta;
type Story = StoryObj<typeof SidePanel>;
export const Default: Story = {
args: {
header: 'Navigation',
children: <NavList />,
},
};
export const DefaultCollapsed: Story = {
args: {
header: 'Navigation',
children: <NavList />,
defaultCollapsed: true,
},
};
export const NarrowWidth: Story = {
args: {
header: 'Filters',
width: 180,
children: <NavList />,
},
};
export const WideWidth: Story = {
args: {
header: 'Scenarios',
width: 320,
children: <NavList />,
},
};
+68
View File
@@ -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>
);
}