import type { Meta, StoryObj } from '@storybook/react-vite' import { MessageBanner } from './MessageBanner' const meta = { title: 'Components/MessageBanner', component: MessageBanner, tags: ['autodocs'], parameters: { layout: 'centered' }, decorators: [ (Story) => (
), ], argTypes: { backgroundColor: { control: 'text' }, highlightColor: { control: 'text' }, icon: { control: 'select', options: ['info', 'success', 'warning', 'error'] }, shape: { control: 'select', options: ['SQUARED', 'SEMI_ROUNDED', 'ROUNDED'] }, marginBelow: { control: 'select', options: ['NONE', 'EVEN_LESS', 'LESS', 'STANDARD', 'MORE', 'EVEN_MORE'] }, }, } satisfies Meta export default meta type Story = StoryObj export const Default: Story = { args: { primaryText: 'Information', secondaryText: 'This is an informational message with default INFO styling.', backgroundColor: 'INFO', highlightColor: 'INFO', icon: 'info', }, } export const Success: Story = { args: { primaryText: 'Success!', secondaryText: 'Your changes have been saved successfully.', backgroundColor: 'SUCCESS', highlightColor: 'POSITIVE', icon: 'success', }, } export const Warning: Story = { args: { primaryText: 'Warning', secondaryText: 'Please review your input before proceeding.', backgroundColor: 'WARN', highlightColor: 'WARN', icon: 'warning', }, } export const Error: Story = { args: { primaryText: 'Error', secondaryText: 'An error occurred while processing your request.', backgroundColor: 'ERROR', highlightColor: 'NEGATIVE', icon: 'error', }, } export const PredefinedStyles: Story = { args: { primaryText: '' }, render: () => (
), } export const CustomColors: Story = { args: { primaryText: 'Custom Colors', secondaryText: 'This banner uses custom hex colors with transparency.', backgroundColor: '#F5B3C380', highlightColor: '#DE0037', shape: 'SQUARED', }, } export const NoDecorativeBar: Story = { args: { primaryText: 'No Decorative Bar', secondaryText: 'This banner has the decorative bar disabled.', backgroundColor: 'INFO', showDecorativeBar: false, shape: 'SEMI_ROUNDED', }, } export const Shapes: Story = { args: { primaryText: '' }, render: () => (
), } export const MarginSpacing: Story = { args: { primaryText: '' }, render: () => (
), } export const WithCloseButton: Story = { args: { primaryText: 'Dismissible Banner', secondaryText: 'Click the X to close this banner.', backgroundColor: 'INFO', highlightColor: 'INFO', icon: 'info', showCloseButton: true, onClose: () => alert('Banner closed'), }, } export const WithActionButtons: Story = { args: { primaryText: 'Action Required', secondaryText: 'Please review the changes before proceeding.', backgroundColor: 'WARN', highlightColor: 'WARN', icon: 'warning', buttons: [ { label: 'Review', style: 'SOLID', color: 'ACCENT', size: 'SMALL' }, { label: 'Dismiss', style: 'OUTLINE', color: 'SECONDARY', size: 'SMALL' }, ], }, } export const WithButtonsAndClose: Story = { args: { primaryText: 'New version available', secondaryText: 'Version 2.5.0 is ready to install.', backgroundColor: 'SUCCESS', highlightColor: 'POSITIVE', icon: 'success', buttons: [ { label: 'Update Now', style: 'SOLID', color: 'POSITIVE', size: 'SMALL' }, ], showCloseButton: true, onClose: () => alert('Banner closed'), }, } export const AllVariantsWithButtons: Story = { args: { primaryText: '' }, render: () => (
{}} /> {}} />
), }