mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-10 00:12:22 +08:00
29 lines
485 B
Plaintext
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,
|
|
}),
|
|
};
|
|
```
|