import type { Meta, StoryObj } from '@storybook/react' import { Badge } from './badge' import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from './table' const meta: Meta = { title: 'Primitives/Table', parameters: { layout: 'centered', backgrounds: { default: 'dark' } }, } export default meta type Story = StoryObj type SessionStatus = 'running' | 'stopped' | 'creating' | 'warm' const sessions: { id: string image: string region: string status: SessionStatus cpu: string memory: string started: string duration: string }[] = [ { id: 'sess_01j9x8k2m4n3p', image: 'node:20-alpine', region: 'us-east-1', status: 'running', cpu: '42%', memory: '256 MB', started: '14:02:11', duration: '47m', }, { id: 'sess_01j9x7r9a1b2c', image: 'python:3.12-slim', region: 'us-east-1', status: 'running', cpu: '8%', memory: '128 MB', started: '13:55:44', duration: '54m', }, { id: 'sess_01j9x6q8z0y1x', image: 'golang:1.22-alpine', region: 'eu-central-1', status: 'warm', cpu: '0%', memory: '64 MB', started: '13:40:02', duration: '1h 9m', }, { id: 'sess_01j9x5p7w9v0u', image: 'node:20-alpine', region: 'us-west-2', status: 'creating', cpu: '—', memory: '—', started: '14:49:58', duration: '< 1s', }, { id: 'sess_01j9x4o6v8u9t', image: 'rust:1.77-slim', region: 'us-east-1', status: 'stopped', cpu: '0%', memory: '0 MB', started: '11:22:30', duration: '3h 27m', }, ] export const SessionsTable: Story = { name: 'Sessions Table', render: () => (
Session ID Image Region Status CPU Memory Started Duration {sessions.map((s) => ( {s.id} {s.image} {s.region} {s.status.charAt(0).toUpperCase() + s.status.slice(1)} {s.cpu} {s.memory} {s.started} {s.duration} ))} {sessions.length} sessions 2 running {' · '} 1 warm · 1 creating · 1 stopped
), } export const SimpleTable: Story = { name: 'Simple Table', render: () => (
Recent billing activity Date Sessions Cost {[ { date: '2026-03-29', sessions: 312, cost: '$4.82' }, { date: '2026-03-28', sessions: 287, cost: '$4.43' }, { date: '2026-03-27', sessions: 401, cost: '$6.19' }, { date: '2026-03-26', sessions: 198, cost: '$3.06' }, { date: '2026-03-25', sessions: 223, cost: '$3.44' }, ].map((row) => ( {row.date} {row.sessions} {row.cost} ))}
), }