diff options
Diffstat (limited to 'src/components/templates/sectioned')
5 files changed, 0 insertions, 190 deletions
| diff --git a/src/components/templates/sectioned/index.ts b/src/components/templates/sectioned/index.ts deleted file mode 100644 index a8c6045..0000000 --- a/src/components/templates/sectioned/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './sectioned-layout'; diff --git a/src/components/templates/sectioned/sectioned-layout.fixtures.tsx b/src/components/templates/sectioned/sectioned-layout.fixtures.tsx deleted file mode 100644 index 0da8e7d..0000000 --- a/src/components/templates/sectioned/sectioned-layout.fixtures.tsx +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable react/jsx-no-literals */ -import { Heading } from '../../atoms'; -import type { PageSection } from './sectioned-layout'; - -export const sections: PageSection[] = [ -  { -    id: 'section-1', -    children: ( -      <> -        <Heading level={2}>Section 1</Heading> -        <div> -          Qui suscipit ea et aut dicta. Quia ut dignissimos. Sapiente beatae -          voluptatem quis et. Nemo vitae magni. Nihil iste officia est sed esse -          molestiae doloribus. Quia temporibus nobis ea fuga quis incidunt -          doloribus eaque. -        </div> -      </> -    ), -  }, -  { -    id: 'section-2', -    children: ( -      <> -        <Heading level={2}>Section 2</Heading> -        <div> -          Reprehenderit aut magnam ut quos. Voluptatibus beatae et. Earum non -          atque voluptatum illum rem distinctio repellat. -        </div> -      </> -    ), -  }, -  { -    id: 'section-3', -    children: ( -      <> -        <Heading level={2}>Section 3</Heading> -        <div> -          Placeat rem dolores dolore illum earum officia dolore. Ut est ducimus. -          Officia eveniet pariatur ut laboriosam voluptatibus aut doloremque -          natus quis. -        </div> -      </> -    ), -  }, -  { -    id: 'section-4', -    children: ( -      <> -        <Heading level={2}>Section 4</Heading> -        <div> -          Vitae facere ipsa eum sunt debitis veritatis dolorem labore qui. -          Dolores recusandae omnis aut. Repudiandae quia neque porro in -          blanditiis. A atque minima fugit. Totam quidem voluptas natus velit -          at. -        </div> -      </> -    ), -  }, -]; diff --git a/src/components/templates/sectioned/sectioned-layout.stories.tsx b/src/components/templates/sectioned/sectioned-layout.stories.tsx deleted file mode 100644 index 0336b7a..0000000 --- a/src/components/templates/sectioned/sectioned-layout.stories.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import type { ComponentMeta, ComponentStory } from '@storybook/react'; -import { LayoutBase } from '../layout/layout.stories'; -import { SectionedLayout as SectionedLayoutComponent } from './sectioned-layout'; -import { sections } from './sectioned-layout.fixtures'; - -/** - * SectionedLayout - Storybook Meta - */ -export default { -  title: 'Templates/Sectioned', -  component: SectionedLayoutComponent, -  args: { -    breadcrumbSchema: [], -  }, -  argTypes: { -    breadcrumbSchema: { -      control: { -        type: null, -      }, -      description: 'The JSON schema for breadcrumb items.', -      type: { -        name: 'object', -        required: true, -        value: {}, -      }, -    }, -    sections: { -      description: 'The different sections.', -      type: { -        name: 'object', -        required: true, -        value: {}, -      }, -    }, -  }, -  decorators: [ -    (Story) => ( -      <LayoutBase {...LayoutBase.args}> -        <Story /> -      </LayoutBase> -    ), -  ], -  parameters: { -    layout: 'fullscreen', -  }, -} as ComponentMeta<typeof SectionedLayoutComponent>; - -const Template: ComponentStory<typeof SectionedLayoutComponent> = (args) => ( -  <SectionedLayoutComponent {...args} /> -); - -/** - * Sectioned Layout Stories - Default - */ -export const Sectioned = Template.bind({}); -Sectioned.args = { -  sections, -}; diff --git a/src/components/templates/sectioned/sectioned-layout.test.tsx b/src/components/templates/sectioned/sectioned-layout.test.tsx deleted file mode 100644 index 372b0fb..0000000 --- a/src/components/templates/sectioned/sectioned-layout.test.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { describe, expect, it } from '@jest/globals'; -import type { BreadcrumbList } from 'schema-dts'; -import { render, screen as rtlScreen } from '../../../../tests/utils'; -import { SectionedLayout } from './sectioned-layout'; -import { sections } from './sectioned-layout.fixtures'; - -const breadcrumbSchema: BreadcrumbList['itemListElement'][] = []; - -describe('SectionedLayout', () => { -  it('renders the correct number of section', () => { -    render( -      <SectionedLayout -        breadcrumbSchema={breadcrumbSchema} -        sections={sections} -      /> -    ); -    expect( -      rtlScreen.getAllByRole('heading', { name: /^Section/ }) -    ).toHaveLength(sections.length); -  }); -}); diff --git a/src/components/templates/sectioned/sectioned-layout.tsx b/src/components/templates/sectioned/sectioned-layout.tsx deleted file mode 100644 index 6d58e83..0000000 --- a/src/components/templates/sectioned/sectioned-layout.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import Script from 'next/script'; -import type { FC } from 'react'; -import type { BreadcrumbList } from 'schema-dts'; -import { Section, type SectionProps, type SectionVariant } from '../../atoms'; - -export type PageSection = Required<Pick<SectionProps, 'children' | 'id'>>; - -export type SectionedLayoutProps = { -  /** -   * The breadcrumb JSON schema. -   */ -  breadcrumbSchema: BreadcrumbList['itemListElement'][]; -  /** -   * An array of objects describing each section. -   */ -  sections: PageSection[]; -}; - -/** - * SectionedLayout component - * - * Render a sectioned layout. - */ -export const SectionedLayout: FC<SectionedLayoutProps> = ({ -  breadcrumbSchema, -  sections, -}) => { -  const getSections = (items: PageSection[]) => -    items.map((section, index) => { -      const variant: SectionVariant = index % 2 ? 'light' : 'dark'; -      const isLastSection = index === items.length - 1; - -      return ( -        <Section hasBorder={!isLastSection} key={section.id} variant={variant}> -          {section.children} -        </Section> -      ); -    }); - -  return ( -    <> -      <Script -        dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbSchema) }} -        // eslint-disable-next-line react/jsx-no-literals -- Id allowed. -        id="schema-breadcrumb" -        type="application/ld+json" -      /> -      {getSections(sections)} -    </> -  ); -}; | 
