import { type Meta, type StoryObj } from '@storybook/react-vite' import React from 'react' import { DocsTemplate } from '../../../.storybook' import Button from '../Button/Button' import { InformationPane } from './InformationPane' import { toast } from '../Toast/Toast' import { otherData, productData } from './information-pane-story-data' const meta: Meta = { title: 'Components/InformationPane', component: InformationPane, argTypes: { children: { control: false }, }, parameters: { design: { type: 'figma', url: 'https://www.figma.com/design/RvhKD82948FMQnh5MyCi0o/Web-Design-System?node-id=121-607&t=jsd8kEmb1sJfCa2m-0', }, docs: { page: () => ( The InformationPane component serves as a high-level overview of a product, seller, user profile, or any other entity. It is designed to present essential details in a visually appealing manner, incorporating a name or title, an associated image, and relevant data points. The InformationPane{' '} offers users a quick and informative snapshot, making it useful for providing key insights and context about the entity being displayed. } infoBullets={[ Place the InformationPane to the left of product detail pages, user profiles, or any relevant sections where a concise overview is required. , 'Include relevant data points, such as ratings, reviews, or key attributes, within the Information Pane to offer users a comprehensive understanding.', ]} /> ), }, }, } export default meta type Story = StoryObj const Template: Story = { render: (args) => { return }, } const productName = `Magnesium Glycinate but let’s pretend this actually ends up being a really long title, this is how it would appear.` const imgUrl = 'https://m.media-amazon.com/images/I/41Jd5FzxAkL.SL500.jpg' const productUrl = 'https://www.amazon.com' const BasicStructure = (
) const basicConfig = { labelAndData: { label: 'Storybook', data: 'InformationPane', check: true, }, tag: { children: 'Story', color: 'green' as const, }, edit: () => toast({ type: 'success', message: 'You clicked the edit button', }), children: BasicStructure, } const { labelAndData, tag, edit, children } = basicConfig export const Basic: Story = { ...Template, args: { header: { labelAndData, tag, }, children, }, } export const NoHeaderTag: Story = { ...Template, args: { header: { labelAndData, }, children, }, } export const HeaderWithEdit: Story = { ...Template, args: { header: { labelAndData, edit, }, children, }, } export const HeaderWithTagAndEdit: Story = { ...Template, args: { header: { labelAndData, tag, edit, }, children, }, } export const headerHasLargeContent = { ...Template, args: { header: { labelAndData: { label: 'Storybook', data: 'InformationPane with a lot of content in the header', check: true, }, tag, edit, }, children, }, } export const NoHeader: Story = { ...Template, args: { children, }, } export const LongProductName: Story = { ...Template, args: { header: { labelAndData, tag, }, children: (
), }, } export const NoProductLink: Story = { ...Template, args: { header: { labelAndData, tag, }, children: (
), }, } export const CustomSectionPlacement: Story = { ...Template, args: { header: { labelAndData, tag, }, children: (
), }, } export const CustomSection: Story = { ...Template, args: { header: { labelAndData, tag, }, children: (
Custom content would go here
), }, } function generateLoremIpsumParagraphs(paragraphCount) { const loremIpsumParagraph = (
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
) const paragraphs = new Array(paragraphCount).fill(loremIpsumParagraph) return paragraphs.map((paragraph, index) => (
{paragraph}
)) } const SimpleTemplate: Story = { render: (args) => { return (
{args.children}
This text is not part of the component. It is for demo purposes. {generateLoremIpsumParagraphs(10)}
) }, } export const Simple: Story = { ...SimpleTemplate, args: { header: { labelAndData, tag, }, simple: { product: { name: productName, url: productUrl, }, imgUrl, identifier: 'B0P477ABD2', }, children: ( ), }, }