feat: add ProductImage directive and service; implement storybook for product image component

This commit is contained in:
Lorenz Hilpert
2025-03-10 17:10:11 +01:00
parent ce4a6b36b6
commit abce5f43e2
4 changed files with 82 additions and 1 deletions

View File

@@ -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',
},
};