2024-08-22 15:07:05 +00:00
|
|
|
import type { Meta, StoryObj } from "@storybook/react";
|
2024-10-30 18:20:43 +00:00
|
|
|
import { Table, Row } from "../src/components/Table/Table";
|
2024-08-22 15:07:05 +00:00
|
|
|
import "./Table.stories.css";
|
2024-10-04 16:41:08 +00:00
|
|
|
import { Cell } from "../src";
|
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: {
|
2024-10-04 16:41:08 +00:00
|
|
|
rows: [
|
|
|
|
<Row
|
|
|
|
cells={[
|
|
|
|
<Cell>Ox45678FDGHJKLBSA21</Cell>,
|
|
|
|
<Cell>My file</Cell>,
|
|
|
|
<Cell>Some data</Cell>,
|
|
|
|
<Cell>Some data</Cell>,
|
|
|
|
]}
|
|
|
|
></Row>,
|
2024-08-22 15:07:05 +00:00
|
|
|
],
|
2024-10-04 16:41:08 +00:00
|
|
|
headers: ["id", "title", "other"],
|
2024-08-22 15:07:05 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Scroll: Story = {
|
|
|
|
args: {
|
|
|
|
className: "tableSmall",
|
2024-10-04 16:41:08 +00:00
|
|
|
rows: [
|
|
|
|
<Row
|
|
|
|
cells={[
|
|
|
|
<Cell>Ox45678FDGHJKLBSA21</Cell>,
|
|
|
|
<Cell>My file</Cell>,
|
|
|
|
<Cell>Some data</Cell>,
|
|
|
|
<Cell>Some data</Cell>,
|
|
|
|
]}
|
|
|
|
></Row>,
|
2024-08-22 15:07:05 +00:00
|
|
|
],
|
|
|
|
headers: ["id", "title", "other", "actions"],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2024-10-16 08:07:52 +00:00
|
|
|
export const Sort: Story = {
|
|
|
|
args: {
|
|
|
|
className: "tableSmall",
|
|
|
|
rows: [
|
|
|
|
<Row
|
|
|
|
cells={[
|
|
|
|
<Cell>Ox45678FDGHJKLBSA22</Cell>,
|
|
|
|
<Cell>My file</Cell>,
|
|
|
|
<Cell>1</Cell>,
|
|
|
|
<Cell>Some data</Cell>,
|
|
|
|
]}
|
|
|
|
></Row>,
|
|
|
|
<Row
|
|
|
|
cells={[
|
|
|
|
<Cell>Ox45678FDGHJKLBSA23</Cell>,
|
|
|
|
<Cell>My file</Cell>,
|
|
|
|
<Cell>2</Cell>,
|
|
|
|
<Cell>Some data</Cell>,
|
|
|
|
]}
|
|
|
|
></Row>,
|
|
|
|
],
|
|
|
|
headers: [["id"], ["title"], ["other", () => {}], ["actions"]],
|
2024-11-05 08:51:52 +00:00
|
|
|
defaultSortIndex: 2,
|
2024-10-16 08:07:52 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2024-09-16 16:23:28 +00:00
|
|
|
export const Empty: Story = {
|
|
|
|
args: {
|
2024-10-04 16:41:08 +00:00
|
|
|
rows: [],
|
2024-09-16 16:23:28 +00:00
|
|
|
headers: ["id", "title", "state", "actions"],
|
|
|
|
},
|
|
|
|
};
|