codex-marketplace-ui-compon.../stories/Table.stories.tsx

90 lines
2.1 KiB
TypeScript
Raw Permalink Normal View History

2024-08-22 15:07:05 +00:00
import type { Meta, StoryObj } from "@storybook/react";
import { Table } from "../src/components/Table/Table";
import "./Table.stories.css";
2024-08-28 08:03:35 +00:00
import { StateCell } from "../src/components/Table/StateCell";
import { ActionCell } from "../src/components/Table/ActionCell";
import { BreakCell } from "../src/components/Table/BreakCell";
2024-08-22 15:07:05 +00:00
const meta = {
title: "Components/Table",
component: Table,
parameters: {
layout: "centered",
},
tags: ["autodocs"],
argTypes: {},
} satisfies Meta<typeof Table>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
cells: [
2024-08-28 08:03:35 +00:00
[
<span>Ox45678FDGHJKLBSA21</span>,
<span>My file</span>,
<span>Some data</span>,
<ActionCell
action="Action"
onClick={() => console.info("Hello")}
></ActionCell>,
],
2024-08-22 15:07:05 +00:00
],
headers: ["id", "title", "other", "actions"],
},
};
export const Scroll: Story = {
args: {
className: "tableSmall",
cells: [
2024-08-28 08:03:35 +00:00
[
<span>Ox45678FDGHJKLBSA21</span>,
<span>My file</span>,
<span>Some data</span>,
<ActionCell
action="Action"
onClick={() => console.info("Hello")}
></ActionCell>,
],
2024-08-22 15:07:05 +00:00
],
headers: ["id", "title", "other", "actions"],
},
};
export const BreakableCell: Story = {
args: {
cells: [
2024-08-28 08:03:35 +00:00
[
<BreakCell value="veryverylongvaluetobreak"></BreakCell>,
<span>My file</span>,
<span>Some data</span>,
<ActionCell
action="Action"
onClick={() => console.info("Hello")}
></ActionCell>,
],
2024-08-22 15:07:05 +00:00
],
headers: ["break", "title", "other", "actions"],
className: "tableSmall",
},
};
2024-08-28 08:03:35 +00:00
export const State: Story = {
2024-08-22 15:07:05 +00:00
args: {
cells: [
2024-08-28 08:03:35 +00:00
[
<BreakCell value="veryverylongvaluetobreak"></BreakCell>,
<span>My file</span>,
<StateCell type="error" value="cancelled"></StateCell>,
<ActionCell
action="Action"
onClick={() => console.info("Hello")}
></ActionCell>,
],
2024-08-22 15:07:05 +00:00
],
headers: ["id", "title", "state", "actions"],
},
};