- Batch 6: FAB, FormField, FloatingInput, AvatarUpload - Batch 7: Modal, ConfirmationDialog, ImageViewerModal, ErrorDisplay, LoadingState - Batch 8: DataList, WaveformVisualizer, OptimizedImage, VirtualizedList - Batch 9: ImageCropper, LoadingSpinner, FocusTrap - Achieved total coverage for src/components/ui
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react';
|
|
import { OptimizedImage } from './optimized-image';
|
|
|
|
const meta = {
|
|
title: 'UI/OptimizedImage',
|
|
component: OptimizedImage,
|
|
tags: ['autodocs'],
|
|
argTypes: {
|
|
width: { control: 'number' },
|
|
height: { control: 'number' },
|
|
priority: { control: 'boolean' },
|
|
},
|
|
} satisfies Meta<typeof OptimizedImage>;
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Default: Story = {
|
|
args: {
|
|
src: 'https://images.unsplash.com/photo-1707343843437-caacff5cfa74',
|
|
alt: 'Example Image',
|
|
width: 600,
|
|
height: 400,
|
|
className: 'rounded-lg object-cover',
|
|
},
|
|
};
|
|
|
|
export const WithPlaceholder: Story = {
|
|
args: {
|
|
src: 'https://images.unsplash.com/photo-1682687220063-4742bd7fd538', // High res image
|
|
alt: 'Loading Image',
|
|
width: 600,
|
|
height: 400,
|
|
className: 'rounded-lg object-cover',
|
|
placeholder: <span className="text-white">Loading...</span>,
|
|
},
|
|
};
|
|
|
|
export const ErrorState: Story = {
|
|
args: {
|
|
src: 'https://invalid-url.com/image.jpg',
|
|
alt: 'Broken Image',
|
|
width: 600,
|
|
height: 400,
|
|
className: 'rounded-lg bg-red-100',
|
|
},
|
|
};
|