133 lines
3.3 KiB
TypeScript
133 lines
3.3 KiB
TypeScript
import type { Meta, StoryObj } from "@storybook/react";
|
|
import {
|
|
Table,
|
|
TableHeader,
|
|
TableBody,
|
|
TableHead,
|
|
TableRow,
|
|
TableCell,
|
|
} from "./index";
|
|
|
|
const meta: Meta<typeof Table> = {
|
|
title: "Elements/Table",
|
|
component: Table,
|
|
tags: ["autodocs"],
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof Table>;
|
|
|
|
const invoices = [
|
|
{
|
|
invoice: "INV001",
|
|
paymentStatus: "Paid",
|
|
totalAmount: "$250.00",
|
|
paymentMethod: "Credit Card",
|
|
},
|
|
{
|
|
invoice: "INV002",
|
|
paymentStatus: "Pending",
|
|
totalAmount: "$150.00",
|
|
paymentMethod: "PayPal",
|
|
},
|
|
{
|
|
invoice: "INV003",
|
|
paymentStatus: "Unpaid",
|
|
totalAmount: "$350.00",
|
|
paymentMethod: "Bank Transfer",
|
|
},
|
|
{
|
|
invoice: "INV004",
|
|
paymentStatus: "Paid",
|
|
totalAmount: "$450.00",
|
|
paymentMethod: "Credit Card",
|
|
},
|
|
{
|
|
invoice: "INV005",
|
|
paymentStatus: "Paid",
|
|
totalAmount: "$550.00",
|
|
paymentMethod: "PayPal",
|
|
},
|
|
];
|
|
|
|
export const Default: Story = {
|
|
render: () => {
|
|
return (
|
|
<Table>
|
|
<TableHeader>
|
|
<TableRow>
|
|
<TableHead>Invoice</TableHead>
|
|
<TableHead>Status</TableHead>
|
|
<TableHead>Amount</TableHead>
|
|
<TableHead>Payment Method</TableHead>
|
|
</TableRow>
|
|
</TableHeader>
|
|
<TableBody>
|
|
{invoices.map((invoice) => (
|
|
<TableRow key={invoice.invoice}>
|
|
<TableCell className="font-medium">{invoice.invoice}</TableCell>
|
|
<TableCell>{invoice.paymentStatus}</TableCell>
|
|
<TableCell>{invoice.totalAmount}</TableCell>
|
|
<TableCell>{invoice.paymentMethod}</TableCell>
|
|
</TableRow>
|
|
))}
|
|
</TableBody>
|
|
</Table>
|
|
);
|
|
},
|
|
};
|
|
|
|
export const Secondary: Story = {
|
|
render: () => {
|
|
return (
|
|
<Table variant="secondary">
|
|
<TableHeader>
|
|
<TableRow>
|
|
<TableHead>Invoice</TableHead>
|
|
<TableHead>Status</TableHead>
|
|
<TableHead>Amount</TableHead>
|
|
<TableHead>Payment Method</TableHead>
|
|
</TableRow>
|
|
</TableHeader>
|
|
<TableBody>
|
|
{invoices.map((invoice) => (
|
|
<TableRow key={invoice.invoice}>
|
|
<TableCell className="font-medium">{invoice.invoice}</TableCell>
|
|
<TableCell>{invoice.paymentStatus}</TableCell>
|
|
<TableCell>{invoice.totalAmount}</TableCell>
|
|
<TableCell>{invoice.paymentMethod}</TableCell>
|
|
</TableRow>
|
|
))}
|
|
</TableBody>
|
|
</Table>
|
|
);
|
|
},
|
|
};
|
|
|
|
export const Line: Story = {
|
|
render: () => {
|
|
return (
|
|
<Table variant="line">
|
|
<TableHeader>
|
|
<TableRow>
|
|
<TableHead>Invoice</TableHead>
|
|
<TableHead>Status</TableHead>
|
|
<TableHead>Amount</TableHead>
|
|
<TableHead>Payment Method</TableHead>
|
|
</TableRow>
|
|
</TableHeader>
|
|
<TableBody>
|
|
{invoices.map((invoice) => (
|
|
<TableRow key={invoice.invoice}>
|
|
<TableCell className="font-medium">{invoice.invoice}</TableCell>
|
|
<TableCell>{invoice.paymentStatus}</TableCell>
|
|
<TableCell>{invoice.totalAmount}</TableCell>
|
|
<TableCell>{invoice.paymentMethod}</TableCell>
|
|
</TableRow>
|
|
))}
|
|
</TableBody>
|
|
</Table>
|
|
);
|
|
},
|
|
};
|