import type { Meta, StoryObj } from '@storybook/react-vite' import React from 'react' import { DocsTemplate } from '../../../.storybook' import { PageHeader } from './PageHeader' import { tableHeaderStoryArgs } from '../TableComponents/TableHeader/TableHeaderStoryHelper' import Tag from '../Tag/Tag' const meta: Meta = { title: 'Components/PageHeader', component: PageHeader, parameters: { layout: 'padded', design: { type: 'figma', url: 'https://www.figma.com/design/RvhKD82948FMQnh5MyCi0o/Web-Design-System?node-id=121-341&t=jsd8kEmb1sJfCa2m-0', }, docs: { page: () => ( The PageHeader component serves as a comprehensive header section for a page, offering various optional settings and functionalities to enhance user interaction. It includes options for displaying header information, search functionality, CSV export, page filters, tooltips, and customizable sections for additional content on the left, right, and bottom sections of the header. } infoBullets={[ Utilize the PageHeader component as the header section of a page to provide users with essential information and functionalities. , Optionally utilize the PageHeader.HeaderDivider to add more dividers to the header. This can be useful when one of the section children are used. , Include header information such as name, value, and optional tooltips to convey important details about the page content. , Optionally enable users to download page data in CSV format. , Incorporate page filters to allow users to refine and customize the displayed content based on specific criteria. , Customize the layout and appearance of the PageHeader{' '} by specifying children components for the left, right, and bottom sections, allowing for additional content or actions tailored to the page's requirements. , Optionally integrate search functionality to allow users to search for specific information within the page. , Optionally include tooltip information to provide additional context or information about specific elements within the header. , ]} /> ), }, }, } export default meta type Story = StoryObj const Template: Story = { render: ({ ...args }) => , } const { header, search: baseSearch, download: baseDownload, tooltip, } = tableHeaderStoryArgs const search = { ...baseSearch, value: '', onChange: () => {}, } const download = { ...baseDownload, csvDownloadOptions: baseDownload.csvDownloadOptions.map((option) => ({ ...option, callout: (link?: string | HTMLDivElement) => { if (link instanceof HTMLButtonElement) { option.callout(link) } }, })), } const leftSectionChildren = (
Left Section Children
) const rightSectionChildren = Right Section Children const bottomSectionChildren = (
Bottom Section Children
) // Update header to include tooltip children const updatedHeader = { ...header, tooltip: { ...header.tooltip, children: Tooltip content, }, } export const Basic: Story = { ...Template, args: { header: { ...updatedHeader, tooltip: undefined, }, }, } export const WithSearch: Story = { ...Template, args: { header: updatedHeader, search, }, } export const WithNoHeader: Story = { ...Template, args: { search, }, } export const WithTooltip: Story = { ...Template, args: { header: updatedHeader, search, tooltip, }, } export const WithImage: Story = { ...Template, args: { header: { ...updatedHeader, image: {}, name: undefined, value: undefined, tooltip: undefined, }, search, tooltip, }, } export const WithDownload: Story = { ...Template, args: { header: updatedHeader, search, download, }, } export const WithLeftSectionChildren: Story = { ...Template, args: { header: updatedHeader, search, tooltip, leftSectionChildren, }, } export const WithRightSectionChildren: Story = { ...Template, args: { header: updatedHeader, search, tooltip, rightSectionChildren, }, } export const WithBottomSectionChildren: Story = { ...Template, args: { header: updatedHeader, search, tooltip, bottomSectionChildren, }, } export const WithAllOptions: Story = { ...Template, args: { header: updatedHeader, search, download, tooltip, leftSectionChildren, rightSectionChildren, bottomSectionChildren, }, } export const HeaderLoading: Story = { ...Template, args: { header: updatedHeader, search, download, tooltip, leftSectionChildren, rightSectionChildren, bottomSectionChildren, loading: { headerValue: true, }, }, } export const HeaderImageLoading: Story = { ...Template, args: { header: { ...updatedHeader, image: {}, name: undefined, value: undefined, tooltip: undefined, }, search, download, tooltip, leftSectionChildren, rightSectionChildren, bottomSectionChildren, loading: { headerImage: true, }, }, }