From 1f5f85d6d0fbba755592a29c8bf3a843f3777ef7 Mon Sep 17 00:00:00 2001 From: mariaeilertsen Date: Tue, 11 Mar 2025 13:15:26 +0100 Subject: [PATCH 1/2] docs: table stories --- .../table/stories/table.stories.tsx | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/packages/jokul/src/components/table/stories/table.stories.tsx b/packages/jokul/src/components/table/stories/table.stories.tsx index e69de29bb2d..771167b0960 100644 --- a/packages/jokul/src/components/table/stories/table.stories.tsx +++ b/packages/jokul/src/components/table/stories/table.stories.tsx @@ -0,0 +1,102 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { Table } from "../Table.js"; +import { TableBody } from "../TableBody.js"; +import { TableCaption } from "../TableCaption.js"; +import { TableCell } from "../TableCell.js"; +import { TableHead } from "../TableHead.js"; +import { TableHeader } from "../TableHeader.js"; +import { TableRow } from "../TableRow.js"; +import "../styles/_index.scss"; +import React from "react"; + +const meta = { + title: "Komponenter/Table", + component: Table, + subcomponents: { + TableBody, + TableCaption, + TableCell, + TableHead, + TableHeader, + TableRow, + }, + parameters: { + layout: "centered", + }, + tags: ["autodocs"], +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +const columns = [ + "Dato", + "Saksnummer", + "Kundenummer", + "Kundenavn", + "Milepæl", + "Følger saken", +]; + +const rows = [ + [ + "24.02.2020", + "20-1234567", + "010203 99887", + "Ola Nordmann", + "Opprettet", + "Siri Saksbehandler", + ], + [ + "13.04.2019", + "20-8382811", + "010203 99887", + "Kari Nordkvinne", + "Opprettet", + "Siri Saksbehandler", + ], + [ + "31.07.2017", + "20-1111", + "010203 99887", + "Kari Nordkvinne", + "Opprettet", + "Per Persen", + ], +]; + +export const TableComponent: Story = { + render: (args) => ( + + Overskrift for skjermlesere + + + {columns.map((column, index) => ( + + {column} + + ))} + + + + {rows.map((row, rowIndex) => ( + + {row.map((cell, cellIndex) => ( + + {cell} + + ))} + + ))} + +
+ ), +}; From 052a9e49085fb644b28c00bc51328dbd95173ced Mon Sep 17 00:00:00 2001 From: mariaeilertsen Date: Tue, 11 Mar 2025 13:25:05 +0100 Subject: [PATCH 2/2] docs: fjerna subcomponrnts --- .../jokul/src/components/table/stories/table.stories.tsx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/jokul/src/components/table/stories/table.stories.tsx b/packages/jokul/src/components/table/stories/table.stories.tsx index 771167b0960..5511765e341 100644 --- a/packages/jokul/src/components/table/stories/table.stories.tsx +++ b/packages/jokul/src/components/table/stories/table.stories.tsx @@ -12,14 +12,6 @@ import React from "react"; const meta = { title: "Komponenter/Table", component: Table, - subcomponents: { - TableBody, - TableCaption, - TableCell, - TableHead, - TableHeader, - TableRow, - }, parameters: { layout: "centered", },