import type { Meta, StoryFn } from '@storybook/react' import React from 'react' import AttachmentCard, { AttachmentThumbnail } from '.' type ComponentProps = React.ComponentProps const meta: Meta = { title: 'AttachmentCard', component: AttachmentCard, parameters: { layout: 'centered' }, argTypes: { variant: { control: { type: 'inline-radio' }, options: ['light', 'dark'] }, }, } export default meta const IMAGE_URL = '/image-thumbnail.jpg' const Template: StoryFn = (args) => // Per-variant stories stay in Storybook for browsing/design review but are // individually covered by cells in AllVariants — skip in Chromatic. const skipInChromatic = { chromatic: { disableSnapshot: true } } export const LightImage: StoryFn = Template.bind({}) LightImage.args = { variant: 'light', title: 'sunset.jpg', mimeType: 'image/jpeg', detail: '2.4 MB', thumbnail: ( ), } LightImage.parameters = skipInChromatic export const DarkImage: StoryFn = Template.bind({}) DarkImage.args = { variant: 'dark', title: 'sunset.jpg', mimeType: 'image/jpeg', detail: '2.4 MB', thumbnail: ( ), } DarkImage.parameters = skipInChromatic export const PdfPlaceholder: StoryFn = Template.bind({}) PdfPlaceholder.args = { variant: 'light', title: 'invoice.pdf', mimeType: 'application/pdf', detail: '120 KB', thumbnail: , } PdfPlaceholder.parameters = skipInChromatic export const AudioPosterOnly: StoryFn = Template.bind({}) AudioPosterOnly.args = { variant: 'dark', title: 'voice-memo.m4a', mimeType: 'audio/m4a', detail: '0:42', thumbnail: ( ), } AudioPosterOnly.parameters = skipInChromatic export const UntitledDark: StoryFn = Template.bind({}) UntitledDark.args = { variant: 'dark', mimeType: 'image/png', detail: '1.1 MB', thumbnail: , } UntitledDark.parameters = skipInChromatic export const WithTopBadges: StoryFn = Template.bind({}) WithTopBadges.args = { variant: 'light', title: 'receipt.pdf', mimeType: 'application/pdf', detail: 'Paid', thumbnail: , topLeft: ( Locked ), topRight: ( $5.00 ), } WithTopBadges.parameters = skipInChromatic export const AllVariants: StoryFn = () => { const cards: { label: string; props: ComponentProps }[] = [ { label: 'Light image', props: { variant: 'light', title: 'sunset.jpg', mimeType: 'image/jpeg', detail: '2.4 MB', thumbnail: ( ), }, }, { label: 'Dark image', props: { variant: 'dark', title: 'sunset.jpg', mimeType: 'image/jpeg', detail: '2.4 MB', thumbnail: ( ), }, }, { label: 'Contained image (dark)', props: { variant: 'dark', title: 'portrait.jpg', mimeType: 'image/jpeg', detail: '1.8 MB', thumbnail: ( ), }, }, { label: 'Contained image (light)', props: { variant: 'light', title: 'portrait.jpg', mimeType: 'image/jpeg', detail: '1.8 MB', thumbnail: ( ), }, }, { label: 'PDF placeholder', props: { variant: 'light', title: 'invoice.pdf', mimeType: 'application/pdf', detail: '120 KB', thumbnail: ( ), }, }, { label: 'Audio poster', props: { variant: 'dark', title: 'voice-memo.m4a', mimeType: 'audio/m4a', detail: '0:42', thumbnail: ( ), }, }, { label: 'Untitled (dark)', props: { variant: 'dark', mimeType: 'image/png', detail: '1.1 MB', thumbnail: , }, }, { label: 'With top badges', props: { variant: 'light', title: 'receipt.pdf', mimeType: 'application/pdf', detail: 'Paid', thumbnail: ( ), topLeft: ( Locked ), topRight: ( $5.00 ), }, }, ] return (
{cards.map(({ label, props }) => (
{label}
))}
) }