import type { Meta, StoryObj } from '@storybook/react-vite' import React from 'react' import { DocsTemplate } from '../../../.storybook' import PageFooterComponent from './PageFooter' import { toast } from '../Toast/Toast' const meta: Meta = { title: 'Components/PageFooter', component: PageFooterComponent, parameters: { design: { type: 'figma', url: 'https://www.figma.com/design/RvhKD82948FMQnh5MyCi0o/Web-Design-System?node-id=1701-2180&t=jsd8kEmb1sJfCa2m-0', }, docs: { page: () => ( The PageFooter component is designed to be fixed at the bottom of a page, providing a consistent and accessible action area. It comprises two sections - left and right. It is up to implementation is the left section, right section, or both are used. However, at least one of these sections is required. The left section can contain either a single Button or the Pagination component, catering to different navigation needs. The right section can accommodate 1-3{' '} Button or ButtonGroup components, offering various actions or links. } infoBullets={[ Use the left section sparingly, ensuring it enhances user experience without overcrowding the footer. , Button components can be links, actions, or a{' '} ButtonGroup. , It is recommended to only use 1 Button in mobile for the right section. You can accomplish this by using our{' '} useMediaQuery or useIsMobileView hooks on implementation. It would be best to use a ButtonGroup if you need to display more than one button in mobile. You can keep the buttons separate in screens larger than mobile. , ]} /> ), }, }, } export default meta type Story = StoryObj const PageFooter = (args) => { return ( ) } const Template: Story = { render: ({ ...args }) => , } const button = { type: 'button' as const, children: 'Secondary', onClick: () => { toast({ message: 'Secondary clicked', type: 'success' }) }, } const buttonGroup = { type: 'buttonGroup' as const, styleType: 'primary' as const, buttons: [ { actions: [ { text: 'Action 1', callout: () => toast({ message: 'Action 1 clicked', type: 'success' }), icon: 'pencil' as const, }, { text: 'Action 2', callout: () => toast({ message: 'Action 2 clicked', type: 'success' }), icon: 'plus' as const, }, ], }, { children: 'Primary Action', onClick: () => { toast({ message: 'Primary Action clicked', type: 'success' }) }, }, ], } const unstyledButton = { type: 'button' as const, children: 'Button', as: 'unstyled' as const, onClick: () => { toast({ message: 'Button clicked', type: 'success' }) }, } export const Basic: Story = { ...Template, args: { rightSection: [buttonGroup], }, } export const NoLeftSection: Story = { ...Template, args: { rightSection: [button, buttonGroup], }, } export const NoRightSection: Story = { ...Template, args: { leftSection: button, }, } export const LeftSectionWithPagination: Story = { ...Template, args: { leftSection: { type: 'pagination', totalPages: 10, currentPage: 1, callout: (page) => { toast({ message: `Page was changed to ${page}`, type: 'success' }) }, }, rightSection: [button, buttonGroup], }, } export const RightSectionWithThreeButtons: Story = { ...Template, args: { leftSection: unstyledButton, rightSection: [ button, { type: 'button', styleType: 'primary', destructive: true, onClick: () => { toast({ message: 'Destructive clicked', type: 'success' }) }, children: 'Destructive', }, buttonGroup, ], }, } export const RightSectionWithOneButton: Story = { ...Template, args: { leftSection: button, rightSection: [buttonGroup], }, } export const RightSectionWithConfirmationButton: Story = { ...Template, args: { leftSection: button, rightSection: [ { type: 'button', popoverProps: { position: 'top', }, children: 'Confirmation', as: 'confirmation', confirmation: { type: 'red', header: 'Are you sure?', body: 'This will perform some action. Would you like to continue?', confirmCallout: () => { toast({ message: 'You clicked confirm!', type: 'success' }) }, }, styleType: 'tertiary', }, buttonGroup, ], }, }