storybook/docs/snippets/svelte/component-story-static-asset-with-import.ts.mdx
2023-12-04 21:23:56 +00:00

29 lines
485 B
Plaintext

```ts
// MyComponent.stories.ts
import type { Meta, StoryObj } from '@storybook/svelte';
import MyComponent from './MyComponent.svelte';
import imageFile from './static/image.png';
const meta: Meta<typeof MyComponent> = {
component: MyComponent,
};
export default meta;
type Story = StoryObj<typeof meta>;
const image = {
src: imageFile,
alt: 'my image',
};
export const WithAnImage: Story = {
render: () => ({
Component: MyComponent,
props: image,
}),
};
```