mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
feat: add ProductImage directive and service; implement storybook for product image component
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { argsToTemplate, type Meta, type StoryObj, moduleMetadata } from '@storybook/angular';
|
||||
import { ProductImageDirective, provideProductImageUrl } from '@isa/shared/product-image';
|
||||
|
||||
type ProductImageInputs = {
|
||||
ean: string;
|
||||
imageWidth: number;
|
||||
imageHeight: number;
|
||||
};
|
||||
|
||||
const meta: Meta<ProductImageInputs> = {
|
||||
title: 'shared/product-image/ProductImage',
|
||||
|
||||
decorators: [
|
||||
moduleMetadata({
|
||||
imports: [ProductImageDirective],
|
||||
providers: [provideProductImageUrl('https://produktbilder-test.paragon-data.net')],
|
||||
}),
|
||||
],
|
||||
argTypes: {
|
||||
ean: {
|
||||
control: {
|
||||
type: 'text',
|
||||
},
|
||||
},
|
||||
imageWidth: {
|
||||
control: {
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
imageHeight: {
|
||||
control: {
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
},
|
||||
render: (args) => ({
|
||||
props: args,
|
||||
template: `<img sharedProductImage ${argsToTemplate(args)} />`,
|
||||
}),
|
||||
};
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<ProductImageDirective>;
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
ean: '9783742327529',
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user