-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTable.stories.tsx
More file actions
88 lines (84 loc) · 2.24 KB
/
Copy pathTable.stories.tsx
File metadata and controls
88 lines (84 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import type { Meta, StoryObj } from '@storybook/react-vite'
import {
Table,
TableBody,
TableCaption,
TableCell,
TableFooter,
TableHead,
TableHeader,
TableRow,
} from '../../components/table'
import { expect, within } from 'storybook/test'
const meta: Meta<typeof Table> = {
title: 'Components/Table',
component: Table,
parameters: {
docs: {
description: {
component: 'A responsive table component.',
},
},
layout: 'centered',
design: {
type: 'figma',
url: 'https://www.figma.com/design/dSsI9L6NSpNCorbSdiYd1k/Oasis-Design-System---shadcn-ui---Default---December-2024?node-id=184-890&p=f&t=wiAnBZzlnMC9rGYE-0',
},
},
tags: ['autodocs'],
}
export default meta
type Story = StoryObj<typeof meta>
const invoices = [
{
name: 'WT3',
id: 'rofl1qpdzzm4h73gtes04xjn4whan84s3k33l5gx787l2',
activeInstances: '4',
},
{
name: 'demo-rofl-www',
id: 'rofl1qzlnrvcjsqlwtzxuhuywz3kpvflms2dp7uyc2xwf',
activeInstances: '1',
},
{
name: 'rofl-scheduler',
id: 'rofl1qr95suussttd2g9ehu3zcpgx8ewtwgayyuzsl0x2',
activeInstances: '0',
},
]
export const Default: Story = {
render: () => (
<Table>
<TableCaption>Caption placeholder</TableCaption>
<TableHeader>
<TableRow>
<TableHead></TableHead>
<TableHead>Name</TableHead>
<TableHead>App ID</TableHead>
<TableHead className="text-right">Active instances</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{invoices.map((invoice, index) => (
<TableRow key={invoice.id}>
<TableCell>{index + 1}</TableCell>
<TableCell>{invoice.name}</TableCell>
<TableCell>{invoice.id}</TableCell>
<TableCell className="text-right">{invoice.activeInstances}</TableCell>
</TableRow>
))}
</TableBody>
<TableFooter>
<TableRow>
<TableCell colSpan={3}>Table footer</TableCell>
<TableCell className="text-right">5</TableCell>
</TableRow>
</TableFooter>
</Table>
),
play: async ({ canvasElement }) => {
const canvas = within(canvasElement)
const table = canvas.getByRole('table')
await expect(table).toBeInTheDocument()
},
}