Add comprehensive development roadmap via GitHub Issues
Created 10 detailed GitHub issues covering: - Project activation and management UI (#1-2) - Worker node coordination and visualization (#3-4) - Automated GitHub repository scanning (#5) - Intelligent model-to-issue matching (#6) - Multi-model task execution system (#7) - N8N workflow integration (#8) - Hive-Bzzz P2P bridge (#9) - Peer assistance protocol (#10) Each issue includes detailed specifications, acceptance criteria, technical implementation notes, and dependency mapping. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
566
frontend/src/components/ui/DataTable.stories.tsx
Normal file
@@ -0,0 +1,566 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import DataTable, { Column } from './DataTable';
|
||||
import { Badge } from './badge';
|
||||
import { Button } from './button';
|
||||
|
||||
/**
|
||||
* DataTable component for Hive UI
|
||||
*
|
||||
* A powerful and flexible data table component with sorting, filtering, searching, and pagination.
|
||||
* Perfect for displaying agent lists, task queues, and workflow executions.
|
||||
*/
|
||||
const meta = {
|
||||
title: 'UI Components/DataTable',
|
||||
component: DataTable,
|
||||
parameters: {
|
||||
layout: 'padded',
|
||||
docs: {
|
||||
description: {
|
||||
component: `
|
||||
The DataTable component is a comprehensive solution for displaying tabular data in the Hive application.
|
||||
It provides powerful features for data manipulation and user interaction.
|
||||
|
||||
## Features
|
||||
- **Sorting**: Click column headers to sort data ascending/descending
|
||||
- **Filtering**: Column-specific filters with text, select, and numeric options
|
||||
- **Searching**: Global search across all visible columns
|
||||
- **Pagination**: Built-in pagination with configurable page sizes
|
||||
- **Custom Rendering**: Custom cell renderers for complex content
|
||||
- **Row Actions**: Clickable rows with custom action handlers
|
||||
- **Loading States**: Built-in loading indicator
|
||||
- **Responsive**: Horizontal scrolling on smaller screens
|
||||
|
||||
## Column Configuration
|
||||
\`\`\`tsx
|
||||
const columns: Column<Agent>[] = [
|
||||
{
|
||||
key: 'id',
|
||||
header: 'ID',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
width: 'w-32'
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
header: 'Status',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
filterType: 'select',
|
||||
filterOptions: [
|
||||
{ label: 'Available', value: 'available' },
|
||||
{ label: 'Busy', value: 'busy' },
|
||||
{ label: 'Offline', value: 'offline' }
|
||||
],
|
||||
render: (agent, value) => (
|
||||
<Badge variant={getStatusVariant(value)}>{value}</Badge>
|
||||
)
|
||||
}
|
||||
];
|
||||
\`\`\`
|
||||
|
||||
## Usage
|
||||
\`\`\`tsx
|
||||
import DataTable from '@/components/ui/DataTable';
|
||||
|
||||
<DataTable
|
||||
data={agents}
|
||||
columns={columns}
|
||||
searchable={true}
|
||||
pageSize={10}
|
||||
onRowClick={(agent) => navigate(\`/agents/\${agent.id}\`)}
|
||||
/>
|
||||
\`\`\`
|
||||
`,
|
||||
},
|
||||
},
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
data: {
|
||||
control: false,
|
||||
description: 'Array of data objects to display',
|
||||
},
|
||||
columns: {
|
||||
control: false,
|
||||
description: 'Column configuration array',
|
||||
},
|
||||
searchable: {
|
||||
control: 'boolean',
|
||||
description: 'Enable global search functionality',
|
||||
},
|
||||
searchPlaceholder: {
|
||||
control: 'text',
|
||||
description: 'Placeholder text for search input',
|
||||
},
|
||||
pageSize: {
|
||||
control: 'number',
|
||||
description: 'Number of rows per page',
|
||||
},
|
||||
loading: {
|
||||
control: 'boolean',
|
||||
description: 'Show loading state',
|
||||
},
|
||||
emptyMessage: {
|
||||
control: 'text',
|
||||
description: 'Message displayed when no data is available',
|
||||
},
|
||||
onRowClick: {
|
||||
action: 'row-clicked',
|
||||
description: 'Handler for row click events',
|
||||
},
|
||||
},
|
||||
} satisfies Meta<typeof DataTable>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
// Sample data for stories
|
||||
interface Agent {
|
||||
id: string;
|
||||
name: string;
|
||||
model: string;
|
||||
status: 'available' | 'busy' | 'offline';
|
||||
current_tasks: number;
|
||||
max_concurrent: number;
|
||||
specialization: string;
|
||||
last_heartbeat: string;
|
||||
utilization: number;
|
||||
}
|
||||
|
||||
const sampleAgents: Agent[] = [
|
||||
{
|
||||
id: 'walnut-codellama',
|
||||
name: 'Walnut CodeLlama',
|
||||
model: 'codellama:34b',
|
||||
status: 'available',
|
||||
current_tasks: 2,
|
||||
max_concurrent: 4,
|
||||
specialization: 'kernel_dev',
|
||||
last_heartbeat: '2024-01-15T10:30:00Z',
|
||||
utilization: 0.5,
|
||||
},
|
||||
{
|
||||
id: 'oak-gemma',
|
||||
name: 'Oak Gemma',
|
||||
model: 'gemma:7b',
|
||||
status: 'busy',
|
||||
current_tasks: 3,
|
||||
max_concurrent: 3,
|
||||
specialization: 'tester',
|
||||
last_heartbeat: '2024-01-15T10:29:45Z',
|
||||
utilization: 1.0,
|
||||
},
|
||||
{
|
||||
id: 'ironwood-llama',
|
||||
name: 'Ironwood Llama',
|
||||
model: 'llama2:13b',
|
||||
status: 'offline',
|
||||
current_tasks: 0,
|
||||
max_concurrent: 2,
|
||||
specialization: 'docs_writer',
|
||||
last_heartbeat: '2024-01-15T09:15:22Z',
|
||||
utilization: 0.0,
|
||||
},
|
||||
{
|
||||
id: 'pine-mistral',
|
||||
name: 'Pine Mistral',
|
||||
model: 'mistral:7b',
|
||||
status: 'available',
|
||||
current_tasks: 1,
|
||||
max_concurrent: 4,
|
||||
specialization: 'general_ai',
|
||||
last_heartbeat: '2024-01-15T10:29:58Z',
|
||||
utilization: 0.25,
|
||||
},
|
||||
{
|
||||
id: 'birch-phi',
|
||||
name: 'Birch Phi',
|
||||
model: 'phi:3b',
|
||||
status: 'busy',
|
||||
current_tasks: 2,
|
||||
max_concurrent: 2,
|
||||
specialization: 'profiler',
|
||||
last_heartbeat: '2024-01-15T10:30:12Z',
|
||||
utilization: 1.0,
|
||||
},
|
||||
];
|
||||
|
||||
const getStatusVariant = (status: string) => {
|
||||
switch (status) {
|
||||
case 'available': return 'success';
|
||||
case 'busy': return 'warning';
|
||||
case 'offline': return 'destructive';
|
||||
default: return 'secondary';
|
||||
}
|
||||
};
|
||||
|
||||
const agentColumns: Column<Agent>[] = [
|
||||
{
|
||||
key: 'id',
|
||||
header: 'Agent ID',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
width: 'w-40',
|
||||
},
|
||||
{
|
||||
key: 'name',
|
||||
header: 'Name',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
key: 'model',
|
||||
header: 'Model',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
filterType: 'select',
|
||||
filterOptions: [
|
||||
{ label: 'CodeLlama 34B', value: 'codellama:34b' },
|
||||
{ label: 'Gemma 7B', value: 'gemma:7b' },
|
||||
{ label: 'Llama2 13B', value: 'llama2:13b' },
|
||||
{ label: 'Mistral 7B', value: 'mistral:7b' },
|
||||
{ label: 'Phi 3B', value: 'phi:3b' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
header: 'Status',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
filterType: 'select',
|
||||
filterOptions: [
|
||||
{ label: 'Available', value: 'available' },
|
||||
{ label: 'Busy', value: 'busy' },
|
||||
{ label: 'Offline', value: 'offline' },
|
||||
],
|
||||
render: (agent, value) => (
|
||||
<Badge variant={getStatusVariant(value) as any}>
|
||||
{value.charAt(0).toUpperCase() + value.slice(1)}
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: 'current_tasks',
|
||||
header: 'Tasks',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
filterType: 'number',
|
||||
render: (agent) => `${agent.current_tasks} / ${agent.max_concurrent}`,
|
||||
},
|
||||
{
|
||||
key: 'specialization',
|
||||
header: 'Specialization',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
filterType: 'select',
|
||||
filterOptions: [
|
||||
{ label: 'Kernel Development', value: 'kernel_dev' },
|
||||
{ label: 'Testing', value: 'tester' },
|
||||
{ label: 'Documentation', value: 'docs_writer' },
|
||||
{ label: 'General AI', value: 'general_ai' },
|
||||
{ label: 'Profiler', value: 'profiler' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'utilization',
|
||||
header: 'Utilization',
|
||||
sortable: true,
|
||||
render: (agent) => {
|
||||
const percentage = Math.round(agent.utilization * 100);
|
||||
return (
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="w-16 bg-gray-200 rounded-full h-2">
|
||||
<div
|
||||
className={`h-2 rounded-full ${
|
||||
percentage >= 80 ? 'bg-red-500' : percentage >= 50 ? 'bg-yellow-500' : 'bg-green-500'
|
||||
}`}
|
||||
style={{ width: `${percentage}%` }}
|
||||
/>
|
||||
</div>
|
||||
<span className="text-sm">{percentage}%</span>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* Basic agent data table
|
||||
*/
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
data: sampleAgents,
|
||||
columns: agentColumns,
|
||||
searchable: true,
|
||||
pageSize: 10,
|
||||
loading: false,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Loading state
|
||||
*/
|
||||
export const Loading: Story = {
|
||||
args: {
|
||||
data: [],
|
||||
columns: agentColumns,
|
||||
loading: true,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Empty state
|
||||
*/
|
||||
export const Empty: Story = {
|
||||
args: {
|
||||
data: [],
|
||||
columns: agentColumns,
|
||||
loading: false,
|
||||
emptyMessage: 'No agents found. Register some agents to get started.',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Small page size for pagination demo
|
||||
*/
|
||||
export const WithPagination: Story = {
|
||||
args: {
|
||||
data: [...sampleAgents, ...sampleAgents, ...sampleAgents], // 15 items
|
||||
columns: agentColumns,
|
||||
pageSize: 3,
|
||||
searchable: true,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Simple task data table
|
||||
*/
|
||||
export const TaskTable: Story = {
|
||||
render: () => {
|
||||
interface Task {
|
||||
id: string;
|
||||
type: string;
|
||||
priority: number;
|
||||
status: string;
|
||||
assigned_agent: string;
|
||||
created_at: string;
|
||||
progress: number;
|
||||
}
|
||||
|
||||
const tasks: Task[] = [
|
||||
{
|
||||
id: 'task-001',
|
||||
type: 'code_analysis',
|
||||
priority: 1,
|
||||
status: 'in_progress',
|
||||
assigned_agent: 'walnut-codellama',
|
||||
created_at: '2024-01-15T10:00:00Z',
|
||||
progress: 75,
|
||||
},
|
||||
{
|
||||
id: 'task-002',
|
||||
type: 'testing',
|
||||
priority: 2,
|
||||
status: 'completed',
|
||||
assigned_agent: 'oak-gemma',
|
||||
created_at: '2024-01-15T09:30:00Z',
|
||||
progress: 100,
|
||||
},
|
||||
{
|
||||
id: 'task-003',
|
||||
type: 'documentation',
|
||||
priority: 3,
|
||||
status: 'pending',
|
||||
assigned_agent: null,
|
||||
created_at: '2024-01-15T10:15:00Z',
|
||||
progress: 0,
|
||||
},
|
||||
];
|
||||
|
||||
const taskColumns: Column<Task>[] = [
|
||||
{
|
||||
key: 'id',
|
||||
header: 'Task ID',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
key: 'type',
|
||||
header: 'Type',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
filterType: 'select',
|
||||
filterOptions: [
|
||||
{ label: 'Code Analysis', value: 'code_analysis' },
|
||||
{ label: 'Testing', value: 'testing' },
|
||||
{ label: 'Documentation', value: 'documentation' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'priority',
|
||||
header: 'Priority',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
filterType: 'select',
|
||||
filterOptions: [
|
||||
{ label: 'Critical (1)', value: 1 },
|
||||
{ label: 'High (2)', value: 2 },
|
||||
{ label: 'Medium (3)', value: 3 },
|
||||
],
|
||||
render: (task) => {
|
||||
const priority = task.priority;
|
||||
const variant = priority === 1 ? 'destructive' : priority === 2 ? 'warning' : 'default';
|
||||
const label = priority === 1 ? 'Critical' : priority === 2 ? 'High' : 'Medium';
|
||||
return <Badge variant={variant as any}>{label}</Badge>;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
header: 'Status',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
filterType: 'select',
|
||||
filterOptions: [
|
||||
{ label: 'Pending', value: 'pending' },
|
||||
{ label: 'In Progress', value: 'in_progress' },
|
||||
{ label: 'Completed', value: 'completed' },
|
||||
],
|
||||
render: (task, value) => {
|
||||
const variant = value === 'completed' ? 'success' : value === 'in_progress' ? 'warning' : 'secondary';
|
||||
return <Badge variant={variant as any}>{value.replace('_', ' ')}</Badge>;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'assigned_agent',
|
||||
header: 'Agent',
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
render: (task, value) => value || <span className="text-gray-400">Unassigned</span>,
|
||||
},
|
||||
{
|
||||
key: 'progress',
|
||||
header: 'Progress',
|
||||
sortable: true,
|
||||
render: (task) => (
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="w-16 bg-gray-200 rounded-full h-2">
|
||||
<div
|
||||
className="bg-blue-500 h-2 rounded-full"
|
||||
style={{ width: `${task.progress}%` }}
|
||||
/>
|
||||
</div>
|
||||
<span className="text-sm">{task.progress}%</span>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<DataTable
|
||||
data={tasks}
|
||||
columns={taskColumns}
|
||||
searchable={true}
|
||||
pageSize={10}
|
||||
emptyMessage="No tasks available"
|
||||
/>
|
||||
);
|
||||
},
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Example task management table with custom rendering and status badges',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Interactive table with row actions
|
||||
*/
|
||||
export const WithRowActions: Story = {
|
||||
render: () => {
|
||||
const handleRowClick = (agent: Agent) => {
|
||||
alert(`Clicked on agent: ${agent.name}`);
|
||||
};
|
||||
|
||||
const columnsWithActions: Column<Agent>[] = [
|
||||
...agentColumns,
|
||||
{
|
||||
key: 'actions',
|
||||
header: 'Actions',
|
||||
render: (agent) => (
|
||||
<div className="flex space-x-2" onClick={(e) => e.stopPropagation()}>
|
||||
<Button size="sm" variant="outline">
|
||||
View
|
||||
</Button>
|
||||
<Button size="sm" variant="default">
|
||||
Assign
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<DataTable
|
||||
data={sampleAgents}
|
||||
columns={columnsWithActions}
|
||||
searchable={true}
|
||||
onRowClick={handleRowClick}
|
||||
pageSize={5}
|
||||
/>
|
||||
);
|
||||
},
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Table with clickable rows and action buttons in cells',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Minimal table without search and filters
|
||||
*/
|
||||
export const Minimal: Story = {
|
||||
render: () => {
|
||||
const minimalColumns: Column<Agent>[] = [
|
||||
{
|
||||
key: 'name',
|
||||
header: 'Agent Name',
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
header: 'Status',
|
||||
render: (agent, value) => (
|
||||
<Badge variant={getStatusVariant(value) as any}>
|
||||
{value.charAt(0).toUpperCase() + value.slice(1)}
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: 'current_tasks',
|
||||
header: 'Active Tasks',
|
||||
render: (agent) => `${agent.current_tasks} / ${agent.max_concurrent}`,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<DataTable
|
||||
data={sampleAgents}
|
||||
columns={minimalColumns}
|
||||
searchable={false}
|
||||
pageSize={10}
|
||||
className="border-0 shadow-none"
|
||||
/>
|
||||
);
|
||||
},
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Simplified table without search, filters, or advanced features',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
258
frontend/src/components/ui/badge.stories.tsx
Normal file
@@ -0,0 +1,258 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Badge } from './badge';
|
||||
|
||||
/**
|
||||
* Badge component for Hive UI
|
||||
*
|
||||
* A small status indicator component used to display labels, statuses, and categories.
|
||||
* Perfect for showing agent statuses, task priorities, and workflow states.
|
||||
*/
|
||||
const meta = {
|
||||
title: 'UI Components/Badge',
|
||||
component: Badge,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
docs: {
|
||||
description: {
|
||||
component: `
|
||||
The Badge component is used to display small labels and status indicators throughout the Hive application.
|
||||
It's commonly used for showing agent statuses, task priorities, and other categorical information.
|
||||
|
||||
## Features
|
||||
- Multiple color variants for different semantic meanings
|
||||
- Consistent sizing and typography
|
||||
- Rounded pill design for modern appearance
|
||||
- Customizable through className prop
|
||||
|
||||
## Usage
|
||||
\`\`\`tsx
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
|
||||
<Badge variant="success">Online</Badge>
|
||||
<Badge variant="warning">Busy</Badge>
|
||||
<Badge variant="destructive">Offline</Badge>
|
||||
\`\`\`
|
||||
|
||||
## Semantic Meanings
|
||||
- **default**: Primary information or neutral status
|
||||
- **secondary**: Less important or secondary information
|
||||
- **success**: Positive status (available, completed, healthy)
|
||||
- **warning**: Attention needed (busy, pending, degraded)
|
||||
- **destructive**: Negative status (error, failed, offline)
|
||||
- **outline**: Minimal emphasis or placeholder
|
||||
`,
|
||||
},
|
||||
},
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
variant: {
|
||||
control: 'select',
|
||||
options: ['default', 'secondary', 'destructive', 'outline', 'success', 'warning'],
|
||||
description: 'Visual variant of the badge',
|
||||
},
|
||||
className: {
|
||||
control: 'text',
|
||||
description: 'Additional CSS classes',
|
||||
},
|
||||
children: {
|
||||
control: 'text',
|
||||
description: 'Badge content',
|
||||
},
|
||||
},
|
||||
} satisfies Meta<typeof Badge>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
/**
|
||||
* Default blue badge
|
||||
*/
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
children: 'Default',
|
||||
variant: 'default',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Secondary gray badge
|
||||
*/
|
||||
export const Secondary: Story = {
|
||||
args: {
|
||||
children: 'Secondary',
|
||||
variant: 'secondary',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Success green badge
|
||||
*/
|
||||
export const Success: Story = {
|
||||
args: {
|
||||
children: 'Available',
|
||||
variant: 'success',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Warning yellow badge
|
||||
*/
|
||||
export const Warning: Story = {
|
||||
args: {
|
||||
children: 'Busy',
|
||||
variant: 'warning',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Destructive red badge
|
||||
*/
|
||||
export const Destructive: Story = {
|
||||
args: {
|
||||
children: 'Offline',
|
||||
variant: 'destructive',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Outline variant
|
||||
*/
|
||||
export const Outline: Story = {
|
||||
args: {
|
||||
children: 'Outline',
|
||||
variant: 'outline',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* All variants showcase
|
||||
*/
|
||||
export const AllVariants: Story = {
|
||||
render: () => (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Badge variant="default">Default</Badge>
|
||||
<Badge variant="secondary">Secondary</Badge>
|
||||
<Badge variant="success">Success</Badge>
|
||||
<Badge variant="warning">Warning</Badge>
|
||||
<Badge variant="destructive">Destructive</Badge>
|
||||
<Badge variant="outline">Outline</Badge>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'All available badge variants displayed together',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Agent status badges as used in Hive
|
||||
*/
|
||||
export const AgentStatuses: Story = {
|
||||
render: () => (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Badge variant="success">Available</Badge>
|
||||
<Badge variant="warning">Busy</Badge>
|
||||
<Badge variant="destructive">Offline</Badge>
|
||||
<Badge variant="secondary">Maintenance</Badge>
|
||||
<Badge variant="default">Connected</Badge>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Common agent status badges used throughout the Hive application',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Task priority badges
|
||||
*/
|
||||
export const TaskPriorities: Story = {
|
||||
render: () => (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Badge variant="destructive">Critical</Badge>
|
||||
<Badge variant="warning">High</Badge>
|
||||
<Badge variant="default">Medium</Badge>
|
||||
<Badge variant="secondary">Low</Badge>
|
||||
<Badge variant="outline">Background</Badge>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Task priority badges with semantic color coding',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Task status badges
|
||||
*/
|
||||
export const TaskStatuses: Story = {
|
||||
render: () => (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Badge variant="secondary">Pending</Badge>
|
||||
<Badge variant="warning">In Progress</Badge>
|
||||
<Badge variant="success">Completed</Badge>
|
||||
<Badge variant="destructive">Failed</Badge>
|
||||
<Badge variant="outline">Cancelled</Badge>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Task execution status badges used in task management',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Workflow status badges
|
||||
*/
|
||||
export const WorkflowStatuses: Story = {
|
||||
render: () => (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Badge variant="success">Active</Badge>
|
||||
<Badge variant="warning">Running</Badge>
|
||||
<Badge variant="secondary">Paused</Badge>
|
||||
<Badge variant="destructive">Failed</Badge>
|
||||
<Badge variant="outline">Draft</Badge>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Workflow status badges used in workflow management',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Custom styled badges
|
||||
*/
|
||||
export const CustomStyling: Story = {
|
||||
render: () => (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Badge variant="default" className="text-lg px-4 py-1">Large Badge</Badge>
|
||||
<Badge variant="success" className="uppercase tracking-wider">Success</Badge>
|
||||
<Badge variant="warning" className="animate-pulse">Flashing</Badge>
|
||||
<Badge variant="outline" className="border-dashed border-2">Dashed Border</Badge>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Examples of custom styling applied to badges using the className prop',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
interface BadgeProps {
|
||||
className?: string;
|
||||
variant?: 'default' | 'secondary' | 'destructive' | 'outline';
|
||||
variant?: 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning';
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ export const Badge: React.FC<BadgeProps> = ({
|
||||
default: 'bg-blue-600 text-white',
|
||||
secondary: 'bg-gray-100 text-gray-900',
|
||||
destructive: 'bg-red-600 text-white',
|
||||
outline: 'border border-gray-300 bg-white'
|
||||
outline: 'border border-gray-300 bg-white',
|
||||
success: 'bg-green-600 text-white',
|
||||
warning: 'bg-yellow-600 text-white'
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
241
frontend/src/components/ui/button.stories.tsx
Normal file
@@ -0,0 +1,241 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Button } from './button';
|
||||
|
||||
/**
|
||||
* Button component for Hive UI
|
||||
*
|
||||
* A versatile button component with multiple variants, sizes, and states.
|
||||
* Supports all standard button functionality with consistent styling.
|
||||
*/
|
||||
const meta = {
|
||||
title: 'UI Components/Button',
|
||||
component: Button,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
docs: {
|
||||
description: {
|
||||
component: `
|
||||
The Button component is a fundamental UI element used throughout the Hive application.
|
||||
It provides consistent styling and behavior across different contexts.
|
||||
|
||||
## Features
|
||||
- Multiple visual variants (default, destructive, outline, secondary, ghost)
|
||||
- Different sizes (small, default, large)
|
||||
- Disabled state support
|
||||
- Loading state (future enhancement)
|
||||
- Icon support (via children)
|
||||
- Full accessibility support
|
||||
|
||||
## Usage
|
||||
\`\`\`tsx
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
<Button variant="default" size="default" onClick={handleClick}>
|
||||
Click me
|
||||
</Button>
|
||||
\`\`\`
|
||||
`,
|
||||
},
|
||||
},
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
variant: {
|
||||
control: 'select',
|
||||
options: ['default', 'destructive', 'outline', 'secondary', 'ghost'],
|
||||
description: 'Visual variant of the button',
|
||||
},
|
||||
size: {
|
||||
control: 'select',
|
||||
options: ['sm', 'default', 'lg'],
|
||||
description: 'Size of the button',
|
||||
},
|
||||
disabled: {
|
||||
control: 'boolean',
|
||||
description: 'Whether the button is disabled',
|
||||
},
|
||||
type: {
|
||||
control: 'select',
|
||||
options: ['button', 'submit', 'reset'],
|
||||
description: 'HTML button type',
|
||||
},
|
||||
children: {
|
||||
control: 'text',
|
||||
description: 'Button content',
|
||||
},
|
||||
onClick: {
|
||||
action: 'clicked',
|
||||
description: 'Click event handler',
|
||||
},
|
||||
},
|
||||
args: {
|
||||
onClick: () => console.log('Button clicked'),
|
||||
},
|
||||
} satisfies Meta<typeof Button>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
/**
|
||||
* Default button style with primary blue color
|
||||
*/
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
children: 'Default Button',
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Destructive variant for dangerous actions like deletion
|
||||
*/
|
||||
export const Destructive: Story = {
|
||||
args: {
|
||||
children: 'Delete Item',
|
||||
variant: 'destructive',
|
||||
size: 'default',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Outline variant for secondary actions
|
||||
*/
|
||||
export const Outline: Story = {
|
||||
args: {
|
||||
children: 'Outline Button',
|
||||
variant: 'outline',
|
||||
size: 'default',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Secondary variant for less important actions
|
||||
*/
|
||||
export const Secondary: Story = {
|
||||
args: {
|
||||
children: 'Secondary Button',
|
||||
variant: 'secondary',
|
||||
size: 'default',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Ghost variant for minimal styling
|
||||
*/
|
||||
export const Ghost: Story = {
|
||||
args: {
|
||||
children: 'Ghost Button',
|
||||
variant: 'ghost',
|
||||
size: 'default',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Small size variant
|
||||
*/
|
||||
export const Small: Story = {
|
||||
args: {
|
||||
children: 'Small Button',
|
||||
variant: 'default',
|
||||
size: 'sm',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Large size variant
|
||||
*/
|
||||
export const Large: Story = {
|
||||
args: {
|
||||
children: 'Large Button',
|
||||
variant: 'default',
|
||||
size: 'lg',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Disabled state
|
||||
*/
|
||||
export const Disabled: Story = {
|
||||
args: {
|
||||
children: 'Disabled Button',
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
disabled: true,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* All variants showcase
|
||||
*/
|
||||
export const AllVariants: Story = {
|
||||
render: () => (
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<Button variant="default">Default</Button>
|
||||
<Button variant="destructive">Destructive</Button>
|
||||
<Button variant="outline">Outline</Button>
|
||||
<Button variant="secondary">Secondary</Button>
|
||||
<Button variant="ghost">Ghost</Button>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Showcase of all button variants side by side',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* All sizes showcase
|
||||
*/
|
||||
export const AllSizes: Story = {
|
||||
render: () => (
|
||||
<div className="flex items-center gap-4">
|
||||
<Button size="sm">Small</Button>
|
||||
<Button size="default">Default</Button>
|
||||
<Button size="lg">Large</Button>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Showcase of all button sizes side by side',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Common Hive use cases
|
||||
*/
|
||||
export const HiveUseCases: Story = {
|
||||
render: () => (
|
||||
<div className="flex flex-col gap-4 max-w-md">
|
||||
<div className="flex gap-2">
|
||||
<Button variant="default">Create Agent</Button>
|
||||
<Button variant="outline">View Details</Button>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button variant="default">Execute Task</Button>
|
||||
<Button variant="secondary">Cancel</Button>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button variant="default">Deploy Workflow</Button>
|
||||
<Button variant="destructive">Stop Execution</Button>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button variant="outline">Export Logs</Button>
|
||||
<Button variant="ghost">Refresh</Button>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Common button combinations used throughout the Hive application',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
340
frontend/src/components/ui/card.stories.tsx
Normal file
@@ -0,0 +1,340 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from './card';
|
||||
import { Button } from './button';
|
||||
import { Badge } from './badge';
|
||||
|
||||
/**
|
||||
* Card component system for Hive UI
|
||||
*
|
||||
* A flexible card component system that provides a container for content.
|
||||
* Includes header, title, description, and content sections.
|
||||
*/
|
||||
const meta = {
|
||||
title: 'UI Components/Card',
|
||||
component: Card,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
docs: {
|
||||
description: {
|
||||
component: `
|
||||
The Card component system provides a structured way to display content in containers.
|
||||
It's composed of several sub-components that work together to create consistent layouts.
|
||||
|
||||
## Components
|
||||
- **Card**: Main container component
|
||||
- **CardHeader**: Header section for titles and descriptions
|
||||
- **CardTitle**: Primary title text
|
||||
- **CardDescription**: Subtitle or description text
|
||||
- **CardContent**: Main content area
|
||||
|
||||
## Features
|
||||
- Consistent styling across the application
|
||||
- Flexible composition with sub-components
|
||||
- Responsive design support
|
||||
- Shadow and border styling
|
||||
- Customizable through className props
|
||||
|
||||
## Usage
|
||||
\`\`\`tsx
|
||||
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '@/components/ui/card';
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Card Title</CardTitle>
|
||||
<CardDescription>Card description goes here</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p>Card content goes here</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
\`\`\`
|
||||
`,
|
||||
},
|
||||
},
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
className: {
|
||||
control: 'text',
|
||||
description: 'Additional CSS classes',
|
||||
},
|
||||
children: {
|
||||
control: false,
|
||||
description: 'Card content',
|
||||
},
|
||||
},
|
||||
} satisfies Meta<typeof Card>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
/**
|
||||
* Basic card with title and content
|
||||
*/
|
||||
export const Default: Story = {
|
||||
render: () => (
|
||||
<Card className="w-80">
|
||||
<CardHeader>
|
||||
<CardTitle>Default Card</CardTitle>
|
||||
<CardDescription>
|
||||
This is a basic card component with a title and description.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p>This is the main content area of the card where you can put any content.</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
),
|
||||
};
|
||||
|
||||
/**
|
||||
* Card with only content, no header
|
||||
*/
|
||||
export const ContentOnly: Story = {
|
||||
render: () => (
|
||||
<Card className="w-80">
|
||||
<CardContent>
|
||||
<p>This card contains only content without a header section.</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
),
|
||||
};
|
||||
|
||||
/**
|
||||
* Agent status card as used in Hive
|
||||
*/
|
||||
export const AgentStatusCard: Story = {
|
||||
render: () => (
|
||||
<Card className="w-96">
|
||||
<CardHeader>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<CardTitle>walnut-codellama</CardTitle>
|
||||
<CardDescription>Code analysis specialist agent</CardDescription>
|
||||
</div>
|
||||
<Badge variant="success">Available</Badge>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-3">
|
||||
<div className="flex justify-between text-sm">
|
||||
<span className="text-gray-600">Model:</span>
|
||||
<span>codellama:34b</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-sm">
|
||||
<span className="text-gray-600">Active Tasks:</span>
|
||||
<span>2 / 4</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-sm">
|
||||
<span className="text-gray-600">Utilization:</span>
|
||||
<span>50%</span>
|
||||
</div>
|
||||
<div className="flex gap-2 mt-4">
|
||||
<Button size="sm" variant="outline">View Details</Button>
|
||||
<Button size="sm" variant="default">Assign Task</Button>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Example of how cards are used to display agent information in the Hive dashboard',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Task execution card as used in Hive
|
||||
*/
|
||||
export const TaskCard: Story = {
|
||||
render: () => (
|
||||
<Card className="w-96">
|
||||
<CardHeader>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<CardTitle>Code Analysis Task</CardTitle>
|
||||
<CardDescription>task-abc123 • 5 minutes ago</CardDescription>
|
||||
</div>
|
||||
<Badge variant="warning">In Progress</Badge>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-3">
|
||||
<div className="flex justify-between text-sm">
|
||||
<span className="text-gray-600">Assigned Agent:</span>
|
||||
<span>walnut-codellama</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-sm">
|
||||
<span className="text-gray-600">Priority:</span>
|
||||
<span>High</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-sm">
|
||||
<span className="text-gray-600">Progress:</span>
|
||||
<span>75%</span>
|
||||
</div>
|
||||
<div className="w-full bg-gray-200 rounded-full h-2 mt-2">
|
||||
<div className="bg-blue-600 h-2 rounded-full" style={{ width: '75%' }}></div>
|
||||
</div>
|
||||
<div className="flex gap-2 mt-4">
|
||||
<Button size="sm" variant="outline">View Logs</Button>
|
||||
<Button size="sm" variant="destructive">Cancel</Button>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Example of how cards are used to display task information in the Hive dashboard',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Workflow card as used in Hive
|
||||
*/
|
||||
export const WorkflowCard: Story = {
|
||||
render: () => (
|
||||
<Card className="w-96">
|
||||
<CardHeader>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<CardTitle>Code Review Pipeline</CardTitle>
|
||||
<CardDescription>Automated code review and testing workflow</CardDescription>
|
||||
</div>
|
||||
<Badge variant="success">Active</Badge>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-3">
|
||||
<div className="flex justify-between text-sm">
|
||||
<span className="text-gray-600">Steps:</span>
|
||||
<span>4</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-sm">
|
||||
<span className="text-gray-600">Success Rate:</span>
|
||||
<span>92.5%</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-sm">
|
||||
<span className="text-gray-600">Last Run:</span>
|
||||
<span>2 hours ago</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-sm">
|
||||
<span className="text-gray-600">Executions:</span>
|
||||
<span>25</span>
|
||||
</div>
|
||||
<div className="flex gap-2 mt-4">
|
||||
<Button size="sm" variant="default">Execute</Button>
|
||||
<Button size="sm" variant="outline">Edit</Button>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Example of how cards are used to display workflow information in the Hive dashboard',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* System metrics card
|
||||
*/
|
||||
export const MetricsCard: Story = {
|
||||
render: () => (
|
||||
<Card className="w-80">
|
||||
<CardHeader>
|
||||
<CardTitle>System Metrics</CardTitle>
|
||||
<CardDescription>Real-time cluster performance</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="text-center">
|
||||
<div className="text-2xl font-bold text-blue-600">12</div>
|
||||
<div className="text-sm text-gray-600">Active Agents</div>
|
||||
</div>
|
||||
<div className="text-center">
|
||||
<div className="text-2xl font-bold text-green-600">8</div>
|
||||
<div className="text-sm text-gray-600">Running Tasks</div>
|
||||
</div>
|
||||
<div className="text-center">
|
||||
<div className="text-2xl font-bold text-purple-600">3</div>
|
||||
<div className="text-sm text-gray-600">Workflows</div>
|
||||
</div>
|
||||
<div className="text-center">
|
||||
<div className="text-2xl font-bold text-orange-600">98.5%</div>
|
||||
<div className="text-sm text-gray-600">Uptime</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Example of a metrics card showing system statistics',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Card grid layout example
|
||||
*/
|
||||
export const CardGrid: Story = {
|
||||
render: () => (
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 max-w-6xl">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Agent 1</CardTitle>
|
||||
<CardDescription>Available</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p>Active tasks: 2/4</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Agent 2</CardTitle>
|
||||
<CardDescription>Busy</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p>Active tasks: 4/4</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Agent 3</CardTitle>
|
||||
<CardDescription>Available</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p>Active tasks: 1/4</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Agent 4</CardTitle>
|
||||
<CardDescription>Offline</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p>Active tasks: 0/4</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Example of cards arranged in a responsive grid layout',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
423
frontend/src/components/ui/input.stories.tsx
Normal file
@@ -0,0 +1,423 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Input } from './input';
|
||||
import { Label } from './label';
|
||||
import { Button } from './button';
|
||||
|
||||
/**
|
||||
* Input component for Hive UI
|
||||
*
|
||||
* A versatile input component for forms and user input throughout the Hive application.
|
||||
* Supports various input types with consistent styling and behavior.
|
||||
*/
|
||||
const meta = {
|
||||
title: 'UI Components/Input',
|
||||
component: Input,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
docs: {
|
||||
description: {
|
||||
component: `
|
||||
The Input component provides consistent styling and behavior for form inputs across the Hive application.
|
||||
It supports all standard HTML input types with enhanced styling and focus states.
|
||||
|
||||
## Features
|
||||
- Consistent styling across all input types
|
||||
- Built-in focus and disabled states
|
||||
- File upload support with custom styling
|
||||
- Form validation integration
|
||||
- Responsive design
|
||||
- Accessibility support
|
||||
|
||||
## Usage
|
||||
\`\`\`tsx
|
||||
import { Input } from '@/components/ui/input';
|
||||
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="Enter agent name"
|
||||
value={agentName}
|
||||
onChange={(e) => setAgentName(e.target.value)}
|
||||
required
|
||||
/>
|
||||
\`\`\`
|
||||
|
||||
## Input Types
|
||||
- **text**: General text input
|
||||
- **email**: Email address input with validation
|
||||
- **password**: Password input with hidden text
|
||||
- **number**: Numeric input with step controls
|
||||
- **search**: Search input with enhanced styling
|
||||
- **url**: URL input with validation
|
||||
- **tel**: Telephone number input
|
||||
- **file**: File upload input
|
||||
`,
|
||||
},
|
||||
},
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
type: {
|
||||
control: 'select',
|
||||
options: ['text', 'email', 'password', 'number', 'search', 'url', 'tel', 'file'],
|
||||
description: 'HTML input type',
|
||||
},
|
||||
placeholder: {
|
||||
control: 'text',
|
||||
description: 'Placeholder text',
|
||||
},
|
||||
value: {
|
||||
control: 'text',
|
||||
description: 'Input value',
|
||||
},
|
||||
disabled: {
|
||||
control: 'boolean',
|
||||
description: 'Whether the input is disabled',
|
||||
},
|
||||
required: {
|
||||
control: 'boolean',
|
||||
description: 'Whether the input is required',
|
||||
},
|
||||
className: {
|
||||
control: 'text',
|
||||
description: 'Additional CSS classes',
|
||||
},
|
||||
onChange: {
|
||||
action: 'changed',
|
||||
description: 'Change event handler',
|
||||
},
|
||||
},
|
||||
args: {
|
||||
onChange: (e: any) => console.log('Input changed:', e.target.value),
|
||||
},
|
||||
} satisfies Meta<typeof Input>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
/**
|
||||
* Default text input
|
||||
*/
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
type: 'text',
|
||||
placeholder: 'Enter text...',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Email input with validation
|
||||
*/
|
||||
export const Email: Story = {
|
||||
args: {
|
||||
type: 'email',
|
||||
placeholder: 'Enter email address',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Password input
|
||||
*/
|
||||
export const Password: Story = {
|
||||
args: {
|
||||
type: 'password',
|
||||
placeholder: 'Enter password',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Number input
|
||||
*/
|
||||
export const Number: Story = {
|
||||
args: {
|
||||
type: 'number',
|
||||
placeholder: 'Enter number',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Search input
|
||||
*/
|
||||
export const Search: Story = {
|
||||
args: {
|
||||
type: 'search',
|
||||
placeholder: 'Search agents...',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* File input
|
||||
*/
|
||||
export const File: Story = {
|
||||
args: {
|
||||
type: 'file',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Disabled state
|
||||
*/
|
||||
export const Disabled: Story = {
|
||||
args: {
|
||||
type: 'text',
|
||||
placeholder: 'Disabled input',
|
||||
disabled: true,
|
||||
value: 'Cannot edit this value',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Required input
|
||||
*/
|
||||
export const Required: Story = {
|
||||
args: {
|
||||
type: 'text',
|
||||
placeholder: 'Required field',
|
||||
required: true,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Input with label (form example)
|
||||
*/
|
||||
export const WithLabel: Story = {
|
||||
render: () => (
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="agent-name">Agent Name</Label>
|
||||
<Input
|
||||
id="agent-name"
|
||||
name="agentName"
|
||||
type="text"
|
||||
placeholder="e.g., walnut-codellama"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Input component used with a label in a form context',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Form example with multiple inputs
|
||||
*/
|
||||
export const FormExample: Story = {
|
||||
render: () => (
|
||||
<div className="space-y-4 w-80">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="agent-id">Agent ID</Label>
|
||||
<Input
|
||||
id="agent-id"
|
||||
name="agentId"
|
||||
type="text"
|
||||
placeholder="unique-agent-id"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="endpoint">Endpoint URL</Label>
|
||||
<Input
|
||||
id="endpoint"
|
||||
name="endpoint"
|
||||
type="url"
|
||||
placeholder="http://hostname:port"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="model">Model Name</Label>
|
||||
<Input
|
||||
id="model"
|
||||
name="model"
|
||||
type="text"
|
||||
placeholder="codellama:34b"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="max-concurrent">Max Concurrent Tasks</Label>
|
||||
<Input
|
||||
id="max-concurrent"
|
||||
name="maxConcurrent"
|
||||
type="number"
|
||||
placeholder="4"
|
||||
min="1"
|
||||
max="10"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2">
|
||||
<Button variant="default" className="flex-1">Register Agent</Button>
|
||||
<Button variant="outline" className="flex-1">Cancel</Button>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Complete form example showing agent registration with multiple input types',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Search and filter inputs
|
||||
*/
|
||||
export const SearchAndFilter: Story = {
|
||||
render: () => (
|
||||
<div className="space-y-4 w-96">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="search-agents">Search Agents</Label>
|
||||
<Input
|
||||
id="search-agents"
|
||||
type="search"
|
||||
placeholder="Search by name, model, or status..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="min-tasks">Min Tasks</Label>
|
||||
<Input
|
||||
id="min-tasks"
|
||||
type="number"
|
||||
placeholder="0"
|
||||
min="0"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="max-tasks">Max Tasks</Label>
|
||||
<Input
|
||||
id="max-tasks"
|
||||
type="number"
|
||||
placeholder="10"
|
||||
min="0"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button variant="default" className="w-full">Apply Filters</Button>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Input components used for search and filtering functionality',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* All input types showcase
|
||||
*/
|
||||
export const AllTypes: Story = {
|
||||
render: () => (
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-4xl">
|
||||
<div className="space-y-2">
|
||||
<Label>Text Input</Label>
|
||||
<Input type="text" placeholder="Text input" />
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Email Input</Label>
|
||||
<Input type="email" placeholder="email@example.com" />
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Password Input</Label>
|
||||
<Input type="password" placeholder="Password" />
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Number Input</Label>
|
||||
<Input type="number" placeholder="123" />
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Search Input</Label>
|
||||
<Input type="search" placeholder="Search..." />
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>URL Input</Label>
|
||||
<Input type="url" placeholder="https://example.com" />
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Tel Input</Label>
|
||||
<Input type="tel" placeholder="+1 (555) 123-4567" />
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>File Input</Label>
|
||||
<Input type="file" />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Showcase of all supported input types',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Validation states example
|
||||
*/
|
||||
export const ValidationStates: Story = {
|
||||
render: () => (
|
||||
<div className="space-y-4 w-80">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="valid-input">Valid Input</Label>
|
||||
<Input
|
||||
id="valid-input"
|
||||
type="text"
|
||||
value="valid-agent-name"
|
||||
className="border-green-500 focus-visible:ring-green-500"
|
||||
/>
|
||||
<p className="text-sm text-green-600">✓ Agent name is available</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="error-input">Error Input</Label>
|
||||
<Input
|
||||
id="error-input"
|
||||
type="text"
|
||||
value="invalid name!"
|
||||
className="border-red-500 focus-visible:ring-red-500"
|
||||
/>
|
||||
<p className="text-sm text-red-600">✗ Agent name contains invalid characters</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="warning-input">Warning Input</Label>
|
||||
<Input
|
||||
id="warning-input"
|
||||
type="text"
|
||||
value="existing-agent"
|
||||
className="border-yellow-500 focus-visible:ring-yellow-500"
|
||||
/>
|
||||
<p className="text-sm text-yellow-600">⚠ Similar agent name already exists</p>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story: 'Examples of input validation states with custom styling',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
54
frontend/src/stories/Button.stories.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { Button } from './Button';
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
||||
const meta = {
|
||||
title: 'Example/Button',
|
||||
component: Button,
|
||||
parameters: {
|
||||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'centered',
|
||||
},
|
||||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
||||
tags: ['autodocs'],
|
||||
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
||||
argTypes: {
|
||||
backgroundColor: { control: 'color' },
|
||||
},
|
||||
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
||||
args: { onClick: fn() },
|
||||
} satisfies Meta<typeof Button>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
||||
export const Primary: Story = {
|
||||
args: {
|
||||
primary: true,
|
||||
label: 'Button',
|
||||
},
|
||||
};
|
||||
|
||||
export const Secondary: Story = {
|
||||
args: {
|
||||
label: 'Button',
|
||||
},
|
||||
};
|
||||
|
||||
export const Large: Story = {
|
||||
args: {
|
||||
size: 'large',
|
||||
label: 'Button',
|
||||
},
|
||||
};
|
||||
|
||||
export const Small: Story = {
|
||||
args: {
|
||||
size: 'small',
|
||||
label: 'Button',
|
||||
},
|
||||
};
|
||||
37
frontend/src/stories/Button.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import React from 'react';
|
||||
|
||||
import './button.css';
|
||||
|
||||
export interface ButtonProps {
|
||||
/** Is this the principal call to action on the page? */
|
||||
primary?: boolean;
|
||||
/** What background color to use */
|
||||
backgroundColor?: string;
|
||||
/** How large should the button be? */
|
||||
size?: 'small' | 'medium' | 'large';
|
||||
/** Button contents */
|
||||
label: string;
|
||||
/** Optional click handler */
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
/** Primary UI component for user interaction */
|
||||
export const Button = ({
|
||||
primary = false,
|
||||
size = 'medium',
|
||||
backgroundColor,
|
||||
label,
|
||||
...props
|
||||
}: ButtonProps) => {
|
||||
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
||||
style={{ backgroundColor }}
|
||||
{...props}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
364
frontend/src/stories/Configure.mdx
Normal file
@@ -0,0 +1,364 @@
|
||||
import { Meta } from "@storybook/addon-docs/blocks";
|
||||
|
||||
import Github from "./assets/github.svg";
|
||||
import Discord from "./assets/discord.svg";
|
||||
import Youtube from "./assets/youtube.svg";
|
||||
import Tutorials from "./assets/tutorials.svg";
|
||||
import Styling from "./assets/styling.png";
|
||||
import Context from "./assets/context.png";
|
||||
import Assets from "./assets/assets.png";
|
||||
import Docs from "./assets/docs.png";
|
||||
import Share from "./assets/share.png";
|
||||
import FigmaPlugin from "./assets/figma-plugin.png";
|
||||
import Testing from "./assets/testing.png";
|
||||
import Accessibility from "./assets/accessibility.png";
|
||||
import Theming from "./assets/theming.png";
|
||||
import AddonLibrary from "./assets/addon-library.png";
|
||||
|
||||
export const RightArrow = () => <svg
|
||||
viewBox="0 0 14 14"
|
||||
width="8px"
|
||||
height="14px"
|
||||
style={{
|
||||
marginLeft: '4px',
|
||||
display: 'inline-block',
|
||||
shapeRendering: 'inherit',
|
||||
verticalAlign: 'middle',
|
||||
fill: 'currentColor',
|
||||
'path fill': 'currentColor'
|
||||
}}
|
||||
>
|
||||
<path d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z" />
|
||||
</svg>
|
||||
|
||||
<Meta title="Configure your project" />
|
||||
|
||||
<div className="sb-container">
|
||||
<div className='sb-section-title'>
|
||||
# Configure your project
|
||||
|
||||
Because Storybook works separately from your app, you'll need to configure it for your specific stack and setup. Below, explore guides for configuring Storybook with popular frameworks and tools. If you get stuck, learn how you can ask for help from our community.
|
||||
</div>
|
||||
<div className="sb-section">
|
||||
<div className="sb-section-item">
|
||||
<img
|
||||
src={Styling}
|
||||
alt="A wall of logos representing different styling technologies"
|
||||
/>
|
||||
<h4 className="sb-section-item-heading">Add styling and CSS</h4>
|
||||
<p className="sb-section-item-paragraph">Like with web applications, there are many ways to include CSS within Storybook. Learn more about setting up styling within Storybook.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/configure/styling-and-css/?renderer=react"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-section-item">
|
||||
<img
|
||||
src={Context}
|
||||
alt="An abstraction representing the composition of data for a component"
|
||||
/>
|
||||
<h4 className="sb-section-item-heading">Provide context and mocking</h4>
|
||||
<p className="sb-section-item-paragraph">Often when a story doesn't render, it's because your component is expecting a specific environment or context (like a theme provider) to be available.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/writing-stories/decorators/?renderer=react#context-for-mocking"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-section-item">
|
||||
<img src={Assets} alt="A representation of typography and image assets" />
|
||||
<div>
|
||||
<h4 className="sb-section-item-heading">Load assets and resources</h4>
|
||||
<p className="sb-section-item-paragraph">To link static files (like fonts) to your projects and stories, use the
|
||||
`staticDirs` configuration option to specify folders to load when
|
||||
starting Storybook.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/configure/images-and-assets/?renderer=react"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="sb-container">
|
||||
<div className='sb-section-title'>
|
||||
# Do more with Storybook
|
||||
|
||||
Now that you know the basics, let's explore other parts of Storybook that will improve your experience. This list is just to get you started. You can customise Storybook in many ways to fit your needs.
|
||||
</div>
|
||||
|
||||
<div className="sb-section">
|
||||
<div className="sb-features-grid">
|
||||
<div className="sb-grid-item">
|
||||
<img src={Docs} alt="A screenshot showing the autodocs tag being set, pointing a docs page being generated" />
|
||||
<h4 className="sb-section-item-heading">Autodocs</h4>
|
||||
<p className="sb-section-item-paragraph">Auto-generate living,
|
||||
interactive reference documentation from your components and stories.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/writing-docs/autodocs/?renderer=react"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-grid-item">
|
||||
<img src={Share} alt="A browser window showing a Storybook being published to a chromatic.com URL" />
|
||||
<h4 className="sb-section-item-heading">Publish to Chromatic</h4>
|
||||
<p className="sb-section-item-paragraph">Publish your Storybook to review and collaborate with your entire team.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/sharing/publish-storybook/?renderer=react#publish-storybook-with-chromatic"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-grid-item">
|
||||
<img src={FigmaPlugin} alt="Windows showing the Storybook plugin in Figma" />
|
||||
<h4 className="sb-section-item-heading">Figma Plugin</h4>
|
||||
<p className="sb-section-item-paragraph">Embed your stories into Figma to cross-reference the design and live
|
||||
implementation in one place.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/sharing/design-integrations/?renderer=react#embed-storybook-in-figma-with-the-plugin"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-grid-item">
|
||||
<img src={Testing} alt="Screenshot of tests passing and failing" />
|
||||
<h4 className="sb-section-item-heading">Testing</h4>
|
||||
<p className="sb-section-item-paragraph">Use stories to test a component in all its variations, no matter how
|
||||
complex.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/writing-tests/?renderer=react"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-grid-item">
|
||||
<img src={Accessibility} alt="Screenshot of accessibility tests passing and failing" />
|
||||
<h4 className="sb-section-item-heading">Accessibility</h4>
|
||||
<p className="sb-section-item-paragraph">Automatically test your components for a11y issues as you develop.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/writing-tests/accessibility-testing/?renderer=react"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-grid-item">
|
||||
<img src={Theming} alt="Screenshot of Storybook in light and dark mode" />
|
||||
<h4 className="sb-section-item-heading">Theming</h4>
|
||||
<p className="sb-section-item-paragraph">Theme Storybook's UI to personalize it to your project.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/docs/configure/theming/?renderer=react"
|
||||
target="_blank"
|
||||
>Learn more<RightArrow /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='sb-addon'>
|
||||
<div className='sb-addon-text'>
|
||||
<h4>Addons</h4>
|
||||
<p className="sb-section-item-paragraph">Integrate your tools with Storybook to connect workflows.</p>
|
||||
<a
|
||||
href="https://storybook.js.org/addons/"
|
||||
target="_blank"
|
||||
>Discover all addons<RightArrow /></a>
|
||||
</div>
|
||||
<div className='sb-addon-img'>
|
||||
<img src={AddonLibrary} alt="Integrate your tools with Storybook to connect workflows." />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="sb-section sb-socials">
|
||||
<div className="sb-section-item">
|
||||
<img src={Github} alt="Github logo" className="sb-explore-image"/>
|
||||
Join our contributors building the future of UI development.
|
||||
|
||||
<a
|
||||
href="https://github.com/storybookjs/storybook"
|
||||
target="_blank"
|
||||
>Star on GitHub<RightArrow /></a>
|
||||
</div>
|
||||
<div className="sb-section-item">
|
||||
<img src={Discord} alt="Discord logo" className="sb-explore-image"/>
|
||||
<div>
|
||||
Get support and chat with frontend developers.
|
||||
|
||||
<a
|
||||
href="https://discord.gg/storybook"
|
||||
target="_blank"
|
||||
>Join Discord server<RightArrow /></a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="sb-section-item">
|
||||
<img src={Youtube} alt="Youtube logo" className="sb-explore-image"/>
|
||||
<div>
|
||||
Watch tutorials, feature previews and interviews.
|
||||
|
||||
<a
|
||||
href="https://www.youtube.com/@chromaticui"
|
||||
target="_blank"
|
||||
>Watch on YouTube<RightArrow /></a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="sb-section-item">
|
||||
<img src={Tutorials} alt="A book" className="sb-explore-image"/>
|
||||
<p>Follow guided walkthroughs on for key workflows.</p>
|
||||
|
||||
<a
|
||||
href="https://storybook.js.org/tutorials/"
|
||||
target="_blank"
|
||||
>Discover tutorials<RightArrow /></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
{`
|
||||
.sb-container {
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
.sb-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
img {
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.sb-section-title {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.sb-section a:not(h1 a, h2 a, h3 a) {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.sb-section-item, .sb-grid-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sb-section-item-heading {
|
||||
padding-top: 20px !important;
|
||||
padding-bottom: 5px !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.sb-section-item-paragraph {
|
||||
margin: 0;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.sb-chevron {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.sb-features-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-gap: 32px 20px;
|
||||
}
|
||||
|
||||
.sb-socials {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
|
||||
.sb-socials p {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.sb-explore-image {
|
||||
max-height: 32px;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.sb-addon {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
background-color: #EEF3F8;
|
||||
border-radius: 5px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.05);
|
||||
background: #EEF3F8;
|
||||
height: 180px;
|
||||
margin-bottom: 48px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sb-addon-text {
|
||||
padding-left: 48px;
|
||||
max-width: 240px;
|
||||
}
|
||||
|
||||
.sb-addon-text h4 {
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
.sb-addon-img {
|
||||
position: absolute;
|
||||
left: 345px;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 200%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sb-addon-img img {
|
||||
width: 650px;
|
||||
transform: rotate(-15deg);
|
||||
margin-left: 40px;
|
||||
margin-top: -72px;
|
||||
box-shadow: 0 0 1px rgba(255, 255, 255, 0);
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 800px) {
|
||||
.sb-addon-img {
|
||||
left: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.sb-section {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sb-features-grid {
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
}
|
||||
|
||||
.sb-socials {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.sb-addon {
|
||||
height: 280px;
|
||||
align-items: flex-start;
|
||||
padding-top: 32px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sb-addon-text {
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.sb-addon-img {
|
||||
right: 0;
|
||||
left: 0;
|
||||
top: 130px;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
height: auto;
|
||||
width: 124%;
|
||||
}
|
||||
|
||||
.sb-addon-img img {
|
||||
width: 1200px;
|
||||
transform: rotate(-12deg);
|
||||
margin-left: 0;
|
||||
margin-top: 48px;
|
||||
margin-bottom: -40px;
|
||||
margin-left: -24px;
|
||||
}
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
34
frontend/src/stories/Header.stories.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { Header } from './Header';
|
||||
|
||||
const meta = {
|
||||
title: 'Example/Header',
|
||||
component: Header,
|
||||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
||||
tags: ['autodocs'],
|
||||
parameters: {
|
||||
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'fullscreen',
|
||||
},
|
||||
args: {
|
||||
onLogin: fn(),
|
||||
onLogout: fn(),
|
||||
onCreateAccount: fn(),
|
||||
},
|
||||
} satisfies Meta<typeof Header>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const LoggedIn: Story = {
|
||||
args: {
|
||||
user: {
|
||||
name: 'Jane Doe',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const LoggedOut: Story = {};
|
||||
56
frontend/src/stories/Header.tsx
Normal file
@@ -0,0 +1,56 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Button } from './Button';
|
||||
import './header.css';
|
||||
|
||||
type User = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
export interface HeaderProps {
|
||||
user?: User;
|
||||
onLogin?: () => void;
|
||||
onLogout?: () => void;
|
||||
onCreateAccount?: () => void;
|
||||
}
|
||||
|
||||
export const Header = ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => (
|
||||
<header>
|
||||
<div className="storybook-header">
|
||||
<div>
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill="none" fillRule="evenodd">
|
||||
<path
|
||||
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
||||
fill="#FFF"
|
||||
/>
|
||||
<path
|
||||
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
||||
fill="#555AB9"
|
||||
/>
|
||||
<path
|
||||
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
|
||||
fill="#91BAF8"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
<h1>Acme</h1>
|
||||
</div>
|
||||
<div>
|
||||
{user ? (
|
||||
<>
|
||||
<span className="welcome">
|
||||
Welcome, <b>{user.name}</b>!
|
||||
</span>
|
||||
<Button size="small" onClick={onLogout} label="Log out" />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Button size="small" onClick={onLogin} label="Log in" />
|
||||
<Button primary size="small" onClick={onCreateAccount} label="Sign up" />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
195
frontend/src/stories/Introduction.mdx
Normal file
@@ -0,0 +1,195 @@
|
||||
import { Meta } from '@storybook/blocks';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '../components/ui/card';
|
||||
import { Badge } from '../components/ui/badge';
|
||||
import { Button } from '../components/ui/button';
|
||||
|
||||
<Meta title="Introduction/Welcome" />
|
||||
|
||||
# Hive UI Component Library
|
||||
|
||||
Welcome to the **Hive UI Component Library** documentation! This Storybook contains all the reusable components used throughout the Hive Distributed AI Orchestration Platform.
|
||||
|
||||
## About Hive
|
||||
|
||||
Hive is a sophisticated distributed AI orchestration platform that enables seamless coordination of multiple AI agents across different machines and services. The platform provides:
|
||||
|
||||
- **Agent Management**: Register and manage AI agents across your cluster
|
||||
- **Task Orchestration**: Intelligent task distribution and execution
|
||||
- **Workflow Automation**: Multi-step workflow creation and management
|
||||
- **Real-time Monitoring**: Live dashboards and performance metrics
|
||||
- **CLI Integration**: Support for cloud-based AI services through CLI agents
|
||||
|
||||
## Component Library Features
|
||||
|
||||
This component library provides:
|
||||
|
||||
### 🎨 **Consistent Design System**
|
||||
- Unified color palette and typography
|
||||
- Responsive design patterns
|
||||
- Accessibility-first approach
|
||||
- Dark/light theme support
|
||||
|
||||
### 🧩 **Modular Components**
|
||||
- Reusable UI building blocks
|
||||
- Composable component patterns
|
||||
- TypeScript support throughout
|
||||
- Comprehensive prop interfaces
|
||||
|
||||
### 📊 **Data Visualization**
|
||||
- Advanced data tables with sorting and filtering
|
||||
- Interactive charts and metrics
|
||||
- Real-time status indicators
|
||||
- Progress tracking components
|
||||
|
||||
### 🔧 **Developer Experience**
|
||||
- Interactive component playground
|
||||
- Comprehensive documentation
|
||||
- Code examples and best practices
|
||||
- Accessibility guidelines
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install
|
||||
|
||||
# Start Storybook
|
||||
npm run storybook
|
||||
```
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```tsx
|
||||
import { Button, Card, CardHeader, CardTitle, CardContent, Badge } from '@/components/ui';
|
||||
|
||||
function AgentCard({ agent }) {
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<div className="flex items-center justify-between">
|
||||
<CardTitle>{agent.name}</CardTitle>
|
||||
<Badge variant="success">Available</Badge>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p>Model: {agent.model}</p>
|
||||
<Button onClick={() => assignTask(agent)}>
|
||||
Assign Task
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## Component Categories
|
||||
|
||||
### 🔘 **Base Components**
|
||||
- **Button**: Action triggers with multiple variants
|
||||
- **Input**: Form input elements with validation
|
||||
- **Badge**: Status indicators and labels
|
||||
- **Card**: Content containers with flexible layouts
|
||||
|
||||
### 📋 **Data Components**
|
||||
- **DataTable**: Advanced tables with sorting, filtering, and pagination
|
||||
- **Form Elements**: Inputs, selects, checkboxes, and textareas
|
||||
- **Progress**: Progress bars and loading indicators
|
||||
|
||||
### 🖼️ **Layout Components**
|
||||
- **Container**: Page and section layouts
|
||||
- **Grid**: Responsive grid systems
|
||||
- **Navigation**: Header, sidebar, and breadcrumb components
|
||||
|
||||
### 📈 **Dashboard Components**
|
||||
- **Metrics Cards**: System performance indicators
|
||||
- **Agent Status**: Real-time agent monitoring
|
||||
- **Task Queue**: Task management interfaces
|
||||
- **Workflow Builder**: Visual workflow creation tools
|
||||
|
||||
## Design Principles
|
||||
|
||||
### ⚡ **Performance**
|
||||
- Optimized for fast rendering
|
||||
- Minimal bundle size impact
|
||||
- Efficient re-rendering patterns
|
||||
|
||||
### ♿ **Accessibility**
|
||||
- WCAG 2.1 AA compliance
|
||||
- Keyboard navigation support
|
||||
- Screen reader compatibility
|
||||
- Focus management
|
||||
|
||||
### 📱 **Responsive**
|
||||
- Mobile-first design approach
|
||||
- Flexible layouts for all screen sizes
|
||||
- Touch-friendly interactions
|
||||
|
||||
### 🎯 **Usability**
|
||||
- Intuitive interaction patterns
|
||||
- Clear visual hierarchy
|
||||
- Contextual help and feedback
|
||||
|
||||
## Getting Help
|
||||
|
||||
### 📖 **Documentation**
|
||||
Each component includes:
|
||||
- Comprehensive API documentation
|
||||
- Interactive examples
|
||||
- Usage guidelines
|
||||
- Accessibility notes
|
||||
|
||||
### 🔧 **Development**
|
||||
- Component source code links
|
||||
- TypeScript definitions
|
||||
- Testing examples
|
||||
- Performance notes
|
||||
|
||||
### 🚀 **Contributing**
|
||||
To contribute to the component library:
|
||||
1. Follow the existing component patterns
|
||||
2. Include comprehensive documentation
|
||||
3. Add interactive stories
|
||||
4. Ensure accessibility compliance
|
||||
|
||||
## Color Palette
|
||||
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '16px', marginTop: '24px' }}>
|
||||
<div style={{ padding: '16px', backgroundColor: '#3b82f6', color: 'white', borderRadius: '8px' }}>
|
||||
<strong>Primary Blue</strong><br />
|
||||
#3b82f6
|
||||
</div>
|
||||
<div style={{ padding: '16px', backgroundColor: '#10b981', color: 'white', borderRadius: '8px' }}>
|
||||
<strong>Success Green</strong><br />
|
||||
#10b981
|
||||
</div>
|
||||
<div style={{ padding: '16px', backgroundColor: '#f59e0b', color: 'white', borderRadius: '8px' }}>
|
||||
<strong>Warning Yellow</strong><br />
|
||||
#f59e0b
|
||||
</div>
|
||||
<div style={{ padding: '16px', backgroundColor: '#ef4444', color: 'white', borderRadius: '8px' }}>
|
||||
<strong>Error Red</strong><br />
|
||||
#ef4444
|
||||
</div>
|
||||
<div style={{ padding: '16px', backgroundColor: '#6b7280', color: 'white', borderRadius: '8px' }}>
|
||||
<strong>Gray</strong><br />
|
||||
#6b7280
|
||||
</div>
|
||||
</div>
|
||||
|
||||
## Component Examples
|
||||
|
||||
Here's a quick preview of some key components:
|
||||
|
||||
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', marginTop: '24px' }}>
|
||||
<Button variant="default">Primary Action</Button>
|
||||
<Button variant="outline">Secondary Action</Button>
|
||||
<Badge variant="success">Available</Badge>
|
||||
<Badge variant="warning">Busy</Badge>
|
||||
<Badge variant="destructive">Offline</Badge>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
Ready to explore? Start with the **UI Components** section in the sidebar to see all available components and their usage examples.
|
||||
33
frontend/src/stories/Page.stories.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { Page } from './Page';
|
||||
|
||||
const meta = {
|
||||
title: 'Example/Page',
|
||||
component: Page,
|
||||
parameters: {
|
||||
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'fullscreen',
|
||||
},
|
||||
} satisfies Meta<typeof Page>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const LoggedOut: Story = {};
|
||||
|
||||
// More on component testing: https://storybook.js.org/docs/writing-tests/interaction-testing
|
||||
export const LoggedIn: Story = {
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
||||
await expect(loginButton).toBeInTheDocument();
|
||||
await userEvent.click(loginButton);
|
||||
await expect(loginButton).not.toBeInTheDocument();
|
||||
|
||||
const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
||||
await expect(logoutButton).toBeInTheDocument();
|
||||
},
|
||||
};
|
||||
73
frontend/src/stories/Page.tsx
Normal file
@@ -0,0 +1,73 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Header } from './Header';
|
||||
import './page.css';
|
||||
|
||||
type User = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
export const Page: React.FC = () => {
|
||||
const [user, setUser] = React.useState<User>();
|
||||
|
||||
return (
|
||||
<article>
|
||||
<Header
|
||||
user={user}
|
||||
onLogin={() => setUser({ name: 'Jane Doe' })}
|
||||
onLogout={() => setUser(undefined)}
|
||||
onCreateAccount={() => setUser({ name: 'Jane Doe' })}
|
||||
/>
|
||||
|
||||
<section className="storybook-page">
|
||||
<h2>Pages in Storybook</h2>
|
||||
<p>
|
||||
We recommend building UIs with a{' '}
|
||||
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
|
||||
<strong>component-driven</strong>
|
||||
</a>{' '}
|
||||
process starting with atomic components and ending with pages.
|
||||
</p>
|
||||
<p>
|
||||
Render pages with mock data. This makes it easy to build and review page states without
|
||||
needing to navigate to them in your app. Here are some handy patterns for managing page
|
||||
data in Storybook:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
Use a higher-level connected component. Storybook helps you compose such data from the
|
||||
"args" of child component stories
|
||||
</li>
|
||||
<li>
|
||||
Assemble data in the page component from your services. You can mock these services out
|
||||
using Storybook.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
Get a guided tutorial on component-driven development at{' '}
|
||||
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
||||
Storybook tutorials
|
||||
</a>
|
||||
. Read more in the{' '}
|
||||
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">
|
||||
docs
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
<div className="tip-wrapper">
|
||||
<span className="tip">Tip</span> Adjust the width of the canvas with the{' '}
|
||||
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill="none" fillRule="evenodd">
|
||||
<path
|
||||
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
|
||||
id="a"
|
||||
fill="#999"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
Viewports addon in the toolbar
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
);
|
||||
};
|
||||
BIN
frontend/src/stories/assets/accessibility.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
1
frontend/src/stories/assets/accessibility.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="none" viewBox="0 0 48 48"><title>Accessibility</title><circle cx="24.334" cy="24" r="24" fill="#A849FF" fill-opacity=".3"/><path fill="#A470D5" fill-rule="evenodd" d="M27.8609 11.585C27.8609 9.59506 26.2497 7.99023 24.2519 7.99023C22.254 7.99023 20.6429 9.65925 20.6429 11.585C20.6429 13.575 22.254 15.1799 24.2519 15.1799C26.2497 15.1799 27.8609 13.575 27.8609 11.585ZM21.8922 22.6473C21.8467 23.9096 21.7901 25.4788 21.5897 26.2771C20.9853 29.0462 17.7348 36.3314 17.3325 37.2275C17.1891 37.4923 17.1077 37.7955 17.1077 38.1178C17.1077 39.1519 17.946 39.9902 18.9802 39.9902C19.6587 39.9902 20.253 39.6293 20.5814 39.0889L20.6429 38.9874L24.2841 31.22C24.2841 31.22 27.5529 37.9214 27.9238 38.6591C28.2948 39.3967 28.8709 39.9902 29.7168 39.9902C30.751 39.9902 31.5893 39.1519 31.5893 38.1178C31.5893 37.7951 31.3639 37.2265 31.3639 37.2265C30.9581 36.3258 27.698 29.0452 27.0938 26.2771C26.8975 25.4948 26.847 23.9722 26.8056 22.7236C26.7927 22.333 26.7806 21.9693 26.7653 21.6634C26.7008 21.214 27.0231 20.8289 27.4097 20.7005L35.3366 18.3253C36.3033 18.0685 36.8834 16.9773 36.6256 16.0144C36.3678 15.0515 35.2722 14.4737 34.3055 14.7305C34.3055 14.7305 26.8619 17.1057 24.2841 17.1057C21.7062 17.1057 14.456 14.7947 14.456 14.7947C13.4893 14.5379 12.3937 14.9873 12.0715 15.9502C11.7493 16.9131 12.3293 18.0044 13.3604 18.3253L21.2873 20.7005C21.674 20.8289 21.9318 21.214 21.9318 21.6634C21.9174 21.9493 21.9053 22.2857 21.8922 22.6473Z" clip-rule="evenodd"/></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
BIN
frontend/src/stories/assets/addon-library.png
Normal file
|
After Width: | Height: | Size: 456 KiB |
BIN
frontend/src/stories/assets/assets.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
frontend/src/stories/assets/avif-test-image.avif
Normal file
|
After Width: | Height: | Size: 829 B |
BIN
frontend/src/stories/assets/context.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
1
frontend/src/stories/assets/discord.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="33" height="32" fill="none" viewBox="0 0 33 32"><g clip-path="url(#clip0_10031_177575)"><mask id="mask0_10031_177575" style="mask-type:luminance" width="33" height="25" x="0" y="4" maskUnits="userSpaceOnUse"><path fill="#fff" d="M32.5034 4.00195H0.503906V28.7758H32.5034V4.00195Z"/></mask><g mask="url(#mask0_10031_177575)"><path fill="#5865F2" d="M27.5928 6.20817C25.5533 5.27289 23.3662 4.58382 21.0794 4.18916C21.0378 4.18154 20.9962 4.20057 20.9747 4.23864C20.6935 4.73863 20.3819 5.3909 20.1637 5.90358C17.7042 5.53558 15.2573 5.53558 12.8481 5.90358C12.6299 5.37951 12.307 4.73863 12.0245 4.23864C12.003 4.20184 11.9614 4.18281 11.9198 4.18916C9.63431 4.58255 7.44721 5.27163 5.40641 6.20817C5.38874 6.21578 5.3736 6.22848 5.36355 6.24497C1.21508 12.439 0.078646 18.4809 0.636144 24.4478C0.638667 24.477 0.655064 24.5049 0.677768 24.5227C3.41481 26.5315 6.06609 27.7511 8.66815 28.5594C8.70979 28.5721 8.75392 28.5569 8.78042 28.5226C9.39594 27.6826 9.94461 26.7968 10.4151 25.8653C10.4428 25.8107 10.4163 25.746 10.3596 25.7244C9.48927 25.3945 8.66058 24.9922 7.86343 24.5354C7.80038 24.4986 7.79533 24.4084 7.85333 24.3653C8.02108 24.2397 8.18888 24.109 8.34906 23.977C8.37804 23.9529 8.41842 23.9478 8.45249 23.963C13.6894 26.3526 19.359 26.3526 24.5341 23.963C24.5682 23.9465 24.6086 23.9516 24.6388 23.9757C24.799 24.1077 24.9668 24.2397 25.1358 24.3653C25.1938 24.4084 25.19 24.4986 25.127 24.5354C24.3298 25.0011 23.5011 25.3945 22.6296 25.7232C22.5728 25.7447 22.5476 25.8107 22.5754 25.8653C23.0559 26.7955 23.6046 27.6812 24.2087 28.5213C24.234 28.5569 24.2794 28.5721 24.321 28.5594C26.9357 27.7511 29.5869 26.5315 32.324 24.5227C32.348 24.5049 32.3631 24.4783 32.3656 24.4491C33.0328 17.5506 31.2481 11.5584 27.6344 6.24623C27.6256 6.22848 27.6105 6.21578 27.5928 6.20817ZM11.1971 20.8146C9.62043 20.8146 8.32129 19.3679 8.32129 17.5913C8.32129 15.8146 9.59523 14.368 11.1971 14.368C12.8115 14.368 14.0981 15.8273 14.0729 17.5913C14.0729 19.3679 12.7989 20.8146 11.1971 20.8146ZM21.8299 20.8146C20.2533 20.8146 18.9541 19.3679 18.9541 17.5913C18.9541 15.8146 20.228 14.368 21.8299 14.368C23.4444 14.368 24.7309 15.8273 24.7057 17.5913C24.7057 19.3679 23.4444 20.8146 21.8299 20.8146Z"/></g></g><defs><clipPath id="clip0_10031_177575"><rect width="32" height="32" fill="#fff" transform="translate(0.5)"/></clipPath></defs></svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
BIN
frontend/src/stories/assets/docs.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
frontend/src/stories/assets/figma-plugin.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
1
frontend/src/stories/assets/github.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none" viewBox="0 0 32 32"><path fill="#161614" d="M16.0001 0C7.16466 0 0 7.17472 0 16.0256C0 23.1061 4.58452 29.1131 10.9419 31.2322C11.7415 31.3805 12.0351 30.8845 12.0351 30.4613C12.0351 30.0791 12.0202 28.8167 12.0133 27.4776C7.56209 28.447 6.62283 25.5868 6.62283 25.5868C5.89499 23.7345 4.8463 23.2419 4.8463 23.2419C3.39461 22.2473 4.95573 22.2678 4.95573 22.2678C6.56242 22.3808 7.40842 23.9192 7.40842 23.9192C8.83547 26.3691 11.1514 25.6609 12.0645 25.2514C12.2081 24.2156 12.6227 23.5087 13.0803 23.1085C9.52648 22.7032 5.7906 21.3291 5.7906 15.1886C5.7906 13.4389 6.41563 12.0094 7.43916 10.8871C7.27303 10.4834 6.72537 8.85349 7.59415 6.64609C7.59415 6.64609 8.93774 6.21539 11.9953 8.28877C13.2716 7.9337 14.6404 7.75563 16.0001 7.74953C17.3599 7.75563 18.7297 7.9337 20.0084 8.28877C23.0623 6.21539 24.404 6.64609 24.404 6.64609C25.2749 8.85349 24.727 10.4834 24.5608 10.8871C25.5868 12.0094 26.2075 13.4389 26.2075 15.1886C26.2075 21.3437 22.4645 22.699 18.9017 23.0957C19.4756 23.593 19.9869 24.5683 19.9869 26.0634C19.9869 28.2077 19.9684 29.9334 19.9684 30.4613C19.9684 30.8877 20.2564 31.3874 21.0674 31.2301C27.4213 29.1086 32 23.1037 32 16.0256C32 7.17472 24.8364 0 16.0001 0ZM5.99257 22.8288C5.95733 22.9084 5.83227 22.9322 5.71834 22.8776C5.60229 22.8253 5.53711 22.7168 5.57474 22.6369C5.60918 22.5549 5.7345 22.5321 5.85029 22.587C5.9666 22.6393 6.03284 22.7489 5.99257 22.8288ZM6.7796 23.5321C6.70329 23.603 6.55412 23.5701 6.45291 23.4581C6.34825 23.3464 6.32864 23.197 6.40601 23.125C6.4847 23.0542 6.62937 23.0874 6.73429 23.1991C6.83895 23.3121 6.85935 23.4605 6.7796 23.5321ZM7.31953 24.4321C7.2215 24.5003 7.0612 24.4363 6.96211 24.2938C6.86407 24.1513 6.86407 23.9804 6.96422 23.9119C7.06358 23.8435 7.2215 23.905 7.32191 24.0465C7.41968 24.1914 7.41968 24.3623 7.31953 24.4321ZM8.23267 25.4743C8.14497 25.5712 7.95818 25.5452 7.82146 25.413C7.68156 25.2838 7.64261 25.1004 7.73058 25.0035C7.81934 24.9064 8.00719 24.9337 8.14497 25.0648C8.28381 25.1938 8.3262 25.3785 8.23267 25.4743ZM9.41281 25.8262C9.37413 25.9517 9.19423 26.0088 9.013 25.9554C8.83203 25.9005 8.7136 25.7535 8.75016 25.6266C8.78778 25.5003 8.96848 25.4408 9.15104 25.4979C9.33174 25.5526 9.45044 25.6985 9.41281 25.8262ZM10.7559 25.9754C10.7604 26.1076 10.6067 26.2172 10.4165 26.2196C10.2252 26.2238 10.0704 26.1169 10.0683 25.9868C10.0683 25.8534 10.2185 25.7448 10.4098 25.7416C10.6001 25.7379 10.7559 25.8441 10.7559 25.9754ZM12.0753 25.9248C12.0981 26.0537 11.9658 26.1862 11.7769 26.2215C11.5912 26.2554 11.4192 26.1758 11.3957 26.0479C11.3726 25.9157 11.5072 25.7833 11.6927 25.7491C11.8819 25.7162 12.0512 25.7937 12.0753 25.9248Z"/></svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
BIN
frontend/src/stories/assets/share.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
frontend/src/stories/assets/styling.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
frontend/src/stories/assets/testing.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
frontend/src/stories/assets/theming.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
1
frontend/src/stories/assets/tutorials.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="33" height="32" fill="none" viewBox="0 0 33 32"><g clip-path="url(#clip0_10031_177597)"><path fill="#B7F0EF" fill-rule="evenodd" d="M17 7.87059C17 6.48214 17.9812 5.28722 19.3431 5.01709L29.5249 2.99755C31.3238 2.64076 33 4.01717 33 5.85105V22.1344C33 23.5229 32.0188 24.7178 30.6569 24.9879L20.4751 27.0074C18.6762 27.3642 17 25.9878 17 24.1539L17 7.87059Z" clip-rule="evenodd" opacity=".7"/><path fill="#87E6E5" fill-rule="evenodd" d="M1 5.85245C1 4.01857 2.67623 2.64215 4.47507 2.99895L14.6569 5.01848C16.0188 5.28861 17 6.48354 17 7.87198V24.1553C17 25.9892 15.3238 27.3656 13.5249 27.0088L3.34311 24.9893C1.98119 24.7192 1 23.5242 1 22.1358V5.85245Z" clip-rule="evenodd"/><path fill="#61C1FD" fill-rule="evenodd" d="M15.543 5.71289C15.543 5.71289 16.8157 5.96289 17.4002 6.57653C17.9847 7.19016 18.4521 9.03107 18.4521 9.03107C18.4521 9.03107 18.4521 25.1106 18.4521 26.9629C18.4521 28.8152 19.3775 31.4174 19.3775 31.4174L17.4002 28.8947L16.2575 31.4174C16.2575 31.4174 15.543 29.0765 15.543 27.122C15.543 25.1674 15.543 5.71289 15.543 5.71289Z" clip-rule="evenodd"/></g><defs><clipPath id="clip0_10031_177597"><rect width="32" height="32" fill="#fff" transform="translate(0.5)"/></clipPath></defs></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
1
frontend/src/stories/assets/youtube.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none" viewBox="0 0 32 32"><path fill="#ED1D24" d="M31.3313 8.44657C30.9633 7.08998 29.8791 6.02172 28.5022 5.65916C26.0067 5.00026 16 5.00026 16 5.00026C16 5.00026 5.99333 5.00026 3.4978 5.65916C2.12102 6.02172 1.03665 7.08998 0.668678 8.44657C0 10.9053 0 16.0353 0 16.0353C0 16.0353 0 21.1652 0.668678 23.6242C1.03665 24.9806 2.12102 26.0489 3.4978 26.4116C5.99333 27.0703 16 27.0703 16 27.0703C16 27.0703 26.0067 27.0703 28.5022 26.4116C29.8791 26.0489 30.9633 24.9806 31.3313 23.6242C32 21.1652 32 16.0353 32 16.0353C32 16.0353 32 10.9053 31.3313 8.44657Z"/><path fill="#fff" d="M12.7266 20.6934L21.0902 16.036L12.7266 11.3781V20.6934Z"/></svg>
|
||||
|
After Width: | Height: | Size: 716 B |
30
frontend/src/stories/button.css
Normal file
@@ -0,0 +1,30 @@
|
||||
.storybook-button {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
border: 0;
|
||||
border-radius: 3em;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.storybook-button--primary {
|
||||
background-color: #555ab9;
|
||||
color: white;
|
||||
}
|
||||
.storybook-button--secondary {
|
||||
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
|
||||
background-color: transparent;
|
||||
color: #333;
|
||||
}
|
||||
.storybook-button--small {
|
||||
padding: 10px 16px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.storybook-button--medium {
|
||||
padding: 11px 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.storybook-button--large {
|
||||
padding: 12px 24px;
|
||||
font-size: 16px;
|
||||
}
|
||||
32
frontend/src/stories/header.css
Normal file
@@ -0,0 +1,32 @@
|
||||
.storybook-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
padding: 15px 20px;
|
||||
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.storybook-header svg {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.storybook-header h1 {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin: 6px 0 6px 10px;
|
||||
font-weight: 700;
|
||||
font-size: 20px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.storybook-header button + button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.storybook-header .welcome {
|
||||
margin-right: 10px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
}
|
||||
68
frontend/src/stories/page.css
Normal file
@@ -0,0 +1,68 @@
|
||||
.storybook-page {
|
||||
margin: 0 auto;
|
||||
padding: 48px 20px;
|
||||
max-width: 600px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.storybook-page h2 {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin: 0 0 4px;
|
||||
font-weight: 700;
|
||||
font-size: 32px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.storybook-page p {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.storybook-page a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.storybook-page ul {
|
||||
margin: 1em 0;
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
.storybook-page li {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.storybook-page .tip {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-right: 10px;
|
||||
border-radius: 1em;
|
||||
background: #e7fdd8;
|
||||
padding: 4px 12px;
|
||||
color: #357a14;
|
||||
font-weight: 700;
|
||||
font-size: 11px;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
.storybook-page .tip-wrapper {
|
||||
margin-top: 40px;
|
||||
margin-bottom: 40px;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.storybook-page .tip-wrapper svg {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: 3px;
|
||||
margin-right: 4px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.storybook-page .tip-wrapper svg path {
|
||||
fill: #1ea7fd;
|
||||
}
|
||||