veza/apps/web/src/components/ui/ImageViewerModal.stories.tsx
senke 1473d04249 feat(ui): badge polish, DnD feedback, typography system, image lightbox
Badge component:
- Dismissible variant with X button (onDismiss prop)
- Pulse animation variant (pulse prop)
- Enhanced dot-only mode for standalone colored circles

Drag-and-drop visual feedback:
- PlaylistTrackListSortableItem: opacity + shadow + ring on drag, border insertion line
- QueueView: dragOverIndex tracking, bg-primary/5 drop zone highlight
- PlaylistDetailView: same DnD feedback pattern

Typography standardization:
- 9 utility classes: text-display, text-heading-1..4, text-body-lg, text-body, text-caption, text-label
- Applied to 8 page headings (Dashboard, Settings, Library, Search, etc.)
- DESIGN_TOKENS.md updated with typography reference

Image lightbox:
- Keyboard navigation: ArrowLeft/Right for gallery, Escape to close
- Image counter pill: "2 / 5" with backdrop-blur
- Zoom toggle: click to zoom in/out with scale transition
- Loading skeleton: pulse placeholder while image loads

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 23:52:33 +01:00

64 lines
2.1 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/react';
import { ImageViewerModal } from './ImageViewerModal';
import { Button } from './button';
import { useState } from 'react';
const meta = {
title: 'UI/ImageViewerModal',
component: ImageViewerModal,
tags: ['autodocs'],
} satisfies Meta<typeof ImageViewerModal>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
render: () => {
const [open, setOpen] = useState(false);
const image = "https://images.unsplash.com/photo-1682687220742-aba13b6e50ba";
return (
<>
<Button onClick={() => setOpen(true)}>View Image</Button>
{open && (
<ImageViewerModal
src={image}
alt="Nature Landscape"
onClose={() => setOpen(false)}
/>
)}
</>
);
},
};
export const Gallery: Story = {
render: () => {
const [open, setOpen] = useState(false);
const [index, setIndex] = useState(0);
const images = [
"https://images.unsplash.com/photo-1682687220742-aba13b6e50ba",
"https://images.unsplash.com/photo-1682687220063-4742bd7fd538",
"https://images.unsplash.com/photo-1682687220199-d0124f48f95b"
];
return (
<>
<Button onClick={() => setOpen(true)}>Open Gallery</Button>
{open && (
<ImageViewerModal
src={images[index]}
alt={`Gallery Image ${index + 1}`}
onClose={() => setOpen(false)}
hasNext={index < images.length - 1}
hasPrev={index > 0}
onNext={() => setIndex(i => i + 1)}
onPrev={() => setIndex(i => i - 1)}
currentIndex={index + 1}
totalImages={images.length}
/>
)}
</>
);
},
};