70 lines
1.6 KiB
TypeScript
70 lines
1.6 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react';
|
|
import { CartItem } from './CartItem';
|
|
import { fn } from '@storybook/test';
|
|
|
|
const MOCK_ITEM = {
|
|
cartId: 'c1',
|
|
quantity: 1,
|
|
selectedLicense: {
|
|
id: 'lic_1',
|
|
name: 'Commercial',
|
|
price: 49.99,
|
|
description: 'Commercial use',
|
|
features: [],
|
|
type: 'commercial'
|
|
},
|
|
product: {
|
|
id: 'p1',
|
|
title: 'Neon Nights Vol. 1',
|
|
author: 'SynthWave Pro',
|
|
price: 29.99,
|
|
type: 'sample_pack',
|
|
coverUrl: 'https://picsum.photos/200',
|
|
description: 'Best synthwave pack',
|
|
currency: 'USD',
|
|
rating: 4.5,
|
|
features: [],
|
|
licenses: [],
|
|
sellerId: 's1',
|
|
category: 'audio',
|
|
tags: [],
|
|
files: [],
|
|
images: [],
|
|
createdAt: new Date().toISOString(),
|
|
updatedAt: new Date().toISOString(),
|
|
stats: { views: 0, sales: 0, rating: 0, reviewsCount: 0 }
|
|
}
|
|
};
|
|
|
|
const meta: Meta<typeof CartItem> = {
|
|
title: 'Components/Features/Commerce/CartItem',
|
|
component: CartItem,
|
|
parameters: { layout: 'padded' },
|
|
tags: ['autodocs'],
|
|
args: { onRemove: fn() },
|
|
decorators: [
|
|
(Story) => (
|
|
<div className="bg-kodo-background p-4 max-w-2xl">
|
|
<Story />
|
|
</div>
|
|
),
|
|
],
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Default: Story = {
|
|
args: {
|
|
item: MOCK_ITEM as any,
|
|
},
|
|
};
|
|
|
|
export const StandardLicense: Story = {
|
|
args: {
|
|
item: {
|
|
...MOCK_ITEM,
|
|
selectedLicense: undefined,
|
|
} as any,
|
|
},
|
|
};
|