Fixed type errors
This commit is contained in:
parent
2b5ef38064
commit
bf2d0c968a
1 changed files with 9 additions and 10 deletions
|
|
@ -1,7 +1,12 @@
|
||||||
<script module lang="ts">
|
<script module lang="ts">
|
||||||
import { defineMeta } from '@storybook/addon-svelte-csf';
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
||||||
|
import type { ComponentProps } from 'svelte';
|
||||||
import PhotoPack from './PhotoPack.svelte';
|
import PhotoPack from './PhotoPack.svelte';
|
||||||
|
|
||||||
|
type StoryArgs = ComponentProps<typeof PhotoPack> & {
|
||||||
|
imageCount?: number;
|
||||||
|
};
|
||||||
|
|
||||||
const { Story } = defineMeta({
|
const { Story } = defineMeta({
|
||||||
title: 'Components/Multimedia/PhotoPack',
|
title: 'Components/Multimedia/PhotoPack',
|
||||||
component: PhotoPack,
|
component: PhotoPack,
|
||||||
|
|
@ -19,12 +24,6 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ComponentProps } from 'svelte';
|
|
||||||
|
|
||||||
type SmartDefaultsArgs = Omit<ComponentProps<typeof PhotoPack>, 'images'> & {
|
|
||||||
imageCount: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
const defaultImages = [
|
const defaultImages = [
|
||||||
{
|
{
|
||||||
src: 'https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T194630Z_544493697_UP1E.jpeg',
|
src: 'https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T194630Z_544493697_UP1E.jpeg',
|
||||||
|
|
@ -118,11 +117,11 @@
|
||||||
args={{
|
args={{
|
||||||
width: 'wide',
|
width: 'wide',
|
||||||
textWidth: 'normal',
|
textWidth: 'normal',
|
||||||
// @ts-expect-error - imageCount is a custom arg for this story's template
|
// @ts-expect-error custom story arg, not a PhotoPack prop
|
||||||
imageCount: 4,
|
imageCount: 4,
|
||||||
}}
|
}}
|
||||||
argTypes={{
|
argTypes={{
|
||||||
// @ts-expect-error - imageCount is a custom arg for this story's template
|
// @ts-expect-error custom story arg, not a PhotoPack prop
|
||||||
imageCount: {
|
imageCount: {
|
||||||
control: { type: 'range', min: 2, max: 5, step: 1 },
|
control: { type: 'range', min: 2, max: 5, step: 1 },
|
||||||
description:
|
description:
|
||||||
|
|
@ -130,8 +129,8 @@
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{#snippet children(args)}
|
{#snippet template(args)}
|
||||||
{@const { imageCount, ...photoPackProps } = args as SmartDefaultsArgs}
|
{@const { imageCount, ...photoPackProps } = args as StoryArgs}
|
||||||
<PhotoPack
|
<PhotoPack
|
||||||
{...photoPackProps}
|
{...photoPackProps}
|
||||||
images={allImages.slice(0, imageCount || 4)}
|
images={allImages.slice(0, imageCount || 4)}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue