refactor(cart): migrate WishlistView to useCartStore
This commit is contained in:
parent
f9ded822dc
commit
01c4e1bff3
2 changed files with 31 additions and 5 deletions
26
apps/web/src/components/commerce/WishlistView.stories.tsx
Normal file
26
apps/web/src/components/commerce/WishlistView.stories.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { WishlistView } from './WishlistView';
|
||||
|
||||
import { ToastProvider } from '../../components/feedback/ToastProvider';
|
||||
|
||||
const meta: Meta<typeof WishlistView> = {
|
||||
title: 'Components/Commerce/WishlistView',
|
||||
component: WishlistView,
|
||||
parameters: { layout: 'fullscreen' },
|
||||
tags: ['autodocs'],
|
||||
decorators: [
|
||||
(Story) => (
|
||||
<ToastProvider>
|
||||
<div className="bg-kodo-background min-h-screen">
|
||||
<Story />
|
||||
</div>
|
||||
</ToastProvider>
|
||||
),
|
||||
],
|
||||
};
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = { name: 'Par défaut' };
|
||||
export const Empty: Story = { name: 'Vide' };
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import React, { useState } from 'react';
|
||||
import { Card } from '../ui/card';
|
||||
import { Button } from '../ui/button';
|
||||
import { Card } from '../ui/card';
|
||||
import { useCartStore } from '../../stores/cartStore';
|
||||
import { Product } from '../../types';
|
||||
import { useCart } from '../../context/CartContext';
|
||||
import { Heart, ShoppingCart, Trash2, Play, Pause, Zap } from 'lucide-react';
|
||||
import { Heart, Pause, Play, ShoppingCart, Trash2, Zap } from 'lucide-react';
|
||||
import React, { useState } from 'react';
|
||||
import { useToast } from '../../components/feedback/ToastProvider';
|
||||
|
||||
// Mock Wishlist Data
|
||||
|
|
@ -51,7 +51,7 @@ const MOCK_WISHLIST: any[] = [
|
|||
];
|
||||
|
||||
export const WishlistView: React.FC = () => {
|
||||
const { addToCart } = useCart();
|
||||
const addToCart = useCartStore((state) => state.addItem);
|
||||
const { addToast } = useToast();
|
||||
const [wishlist, setWishlist] = useState<Product[]>(MOCK_WISHLIST);
|
||||
const [playingPreview, setPlayingPreview] = useState<string | null>(null);
|
||||
|
|
|
|||
Loading…
Reference in a new issue