import React from 'react' import { type Meta, type StoryObj } from '@storybook/react-vite' import { useLocation, useNavigate } from 'react-router-dom' import MobileRouterTabs from './MobileRouterTabs' import Alert from '../../../Alerts/Alert' import { useMediaQuery } from '../../../../hooks/responsiveHooks' import { DocsTemplate } from '../../../../../.storybook' const meta: Meta = { title: 'Components/Tabs/RouterTabs/Mobile', component: MobileRouterTabs, parameters: { docs: { page: () => ( The RouterTabs component is very similar to{' '} Tabs. It is a user interface element used to organize content into distinct sections, but it also updates the page url when a new tab is clicked. Each tab represents a different section, and when a tab is active, only the content associated with that tab is visible, while the content of other tabs remains hidden. RouterTabs provide an intuitive and space-efficient way to navigate between different sections of a page. } infoBullets={[ Use the RouterTabs component to organize content into distinct sections. , The active tab will appear with unique styles, making it clear which section is currently being viewed. , ]} /> ), }, }, } export default meta type Story = StoryObj const defaultMobileConfig = [ { label: 'At A Glance', link: '/protect/at-a-glance', }, { label: 'Buy Box', link: '/protect/buybox', subrows: [ { label: 'Sellers', link: '/protect/buybox/sellers', }, { label: 'Products', link: '/protect/buybox/products', }, { label: 'Suppression', link: '/protect/buybox/suppression', }, ], }, { label: 'Compliance', link: '/protect/compliance', subrows: [ { label: 'Sellers', link: '/protect/compliance/sellers', }, { label: 'Products', link: '/protect/compliance/products', }, { label: 'Marketplaces', link: '/protect/compliance/marketplaces', }, ], }, { label: 'Selective Distribution', link: '/protect/selective-distribution', subrows: [ { label: 'Overview', link: '/protect/selective-distribution/overview', }, { label: 'Not Authorized', link: '/protect/selective-distribution/not-authorized', }, { label: 'In Progress', link: '/protect/selective-distribution/in-progress', }, { label: 'Authorized & Not Compliant', link: '/protect/selective-distribution/not-compliant', }, { label: 'Authorized', link: '/protect/selective-distribution/authorized', }, ], }, ] const Template: Story = { render: function Render(args) { const isMobileView = useMediaQuery({ type: 'max', breakpoint: 'md' }) const navigate = useNavigate() const { pathname } = useLocation() return isMobileView ? ( ) : ( ) }, } export const Mobile: Story = { ...Template, args: { mobileConfig: defaultMobileConfig, }, }