storybook/docs/snippets/angular/component-story-static-asset-with-import.ts.mdx

31 lines
655 B
Plaintext

```ts
// MyComponent.stories.ts
import type { Meta, StoryFn } from '@storybook/angular';
import { MyComponent } from './MyComponent.component';
import imageFile from './static/image.png';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'img',
component: MyComponent,
} as Meta;
const image = {
src: imageFile,
alt: 'my image',
};
export const WithAnImage: StoryFn () => ({
template: `<img src="{{src}}" alt="{{alt}}" />`,
props: {
src: image.src,
alt: image.alt,
},
});
```