-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
963a7f9
commit 8efe40c
Showing
4 changed files
with
72 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script context="module"> | ||
import Table from './Table.svelte'; | ||
import TableRow from './TableRow.svelte'; | ||
import TableRowItem from './TableRowItem.svelte'; | ||
import { Story, Template } from '@storybook/addon-svelte-csf'; | ||
export const meta = { | ||
title: "Controls/Table", | ||
component: Table, | ||
tags: ['autodocs'] | ||
} | ||
</script> | ||
|
||
<Story name="Default"> | ||
<Table></Table> | ||
</Story> | ||
|
||
<script lang="ts"> | ||
const headerItems: string[] = [ | ||
"Header 1", | ||
"Header 2" | ||
] | ||
const rows: string[][] = [ | ||
["Row 1:1", "Row 2:2"], | ||
["Row 2 1", "Row 2 2"] | ||
] | ||
</script> | ||
|
||
<Template let:args> | ||
<Table {...args}> | ||
<svelte:fragment slot="header"> | ||
{#if !args.hideHeader} | ||
<TableRow> | ||
{#each headerItems as header} | ||
<TableRowItem>{@html header}</TableRowItem> | ||
{/each} | ||
</TableRow> | ||
{/if} | ||
</svelte:fragment> | ||
{#each rows as row} | ||
<TableRow> | ||
{#each row as item} | ||
<TableRowItem>{@html item}</TableRowItem> | ||
{/each} | ||
</TableRow> | ||
{/each} | ||
</Table> | ||
</Template> | ||
|
||
<Story name="Hydrated"/> | ||
<Story name="Start-aligned Header" args={{headerAlignment: "start"}}/> | ||
<Story name="No Header" args={{hideHeader: true}}/> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters