feat: add missing storybook files and type template arguments properly
This commit is contained in:
@@ -37,6 +37,8 @@ const { Story } = defineMeta({
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import type { ComponentProps } from 'svelte';
|
||||
|
||||
const smallDataSet = Array.from({ length: 20 }, (_, i) => `${i + 1}) I will not waste chalk.`);
|
||||
const mediumDataSet = Array.from(
|
||||
{ length: 200 },
|
||||
@@ -45,10 +47,13 @@ const mediumDataSet = Array.from(
|
||||
const emptyDataSet: string[] = [];
|
||||
</script>
|
||||
|
||||
<Story name="Small Dataset">
|
||||
{#snippet template(args)}
|
||||
<Story
|
||||
name="Small Dataset"
|
||||
args={{ items: smallDataSet, itemHeight: 40 }}
|
||||
>
|
||||
{#snippet template(args: ComponentProps<typeof VirtualList>)}
|
||||
<div class="h-[400px]">
|
||||
<VirtualList items={smallDataSet} itemHeight={40} {...args}>
|
||||
<VirtualList {...args}>
|
||||
{#snippet children({ item })}
|
||||
<div class="p-2 m-0.5 rounded-sm hover:bg-accent">{item}</div>
|
||||
{/snippet}
|
||||
@@ -57,10 +62,13 @@ const emptyDataSet: string[] = [];
|
||||
{/snippet}
|
||||
</Story>
|
||||
|
||||
<Story name="Medium Dataset (200 items)">
|
||||
{#snippet template(args)}
|
||||
<Story
|
||||
name="Medium Dataset (200 items)"
|
||||
args={{ items: mediumDataSet, itemHeight: 40 }}
|
||||
>
|
||||
{#snippet template(args: ComponentProps<typeof VirtualList>)}
|
||||
<div class="h-[400px]">
|
||||
<VirtualList items={mediumDataSet} itemHeight={40} {...args}>
|
||||
<VirtualList {...args}>
|
||||
{#snippet children({ item })}
|
||||
<div class="p-2 m-0.5 rounded-sm hover:bg-accent">{item}</div>
|
||||
{/snippet}
|
||||
@@ -69,9 +77,12 @@ const emptyDataSet: string[] = [];
|
||||
{/snippet}
|
||||
</Story>
|
||||
|
||||
<Story name="Empty Dataset">
|
||||
{#snippet template(args)}
|
||||
<VirtualList items={emptyDataSet} itemHeight={40} {...args}>
|
||||
<Story
|
||||
name="Empty Dataset"
|
||||
args={{ items: emptyDataSet, itemHeight: 40 }}
|
||||
>
|
||||
{#snippet template(args: ComponentProps<typeof VirtualList>)}
|
||||
<VirtualList {...args}>
|
||||
{#snippet children({ item })}
|
||||
<div class="p-2 m-0.5 rounded-sm hover:bg-accent">{item}</div>
|
||||
{/snippet}
|
||||
|
||||
Reference in New Issue
Block a user