diff options
Diffstat (limited to 'src/components/atoms/layout/footer')
| -rw-r--r-- | src/components/atoms/layout/footer/footer.stories.tsx | 34 | ||||
| -rw-r--r-- | src/components/atoms/layout/footer/footer.test.tsx | 13 | ||||
| -rw-r--r-- | src/components/atoms/layout/footer/footer.tsx | 23 | ||||
| -rw-r--r-- | src/components/atoms/layout/footer/index.ts | 1 |
4 files changed, 71 insertions, 0 deletions
diff --git a/src/components/atoms/layout/footer/footer.stories.tsx b/src/components/atoms/layout/footer/footer.stories.tsx new file mode 100644 index 0000000..0df1647 --- /dev/null +++ b/src/components/atoms/layout/footer/footer.stories.tsx @@ -0,0 +1,34 @@ +import type { ComponentMeta, ComponentStory } from '@storybook/react'; +import { Footer as FooterComponent } from './footer'; + +/** + * Footer - Storybook Meta + */ +export default { + title: 'Atoms/Layout', + component: FooterComponent, + argTypes: { + children: { + control: { + type: 'text', + }, + description: 'The contents.', + type: { + name: 'string', + required: true, + }, + }, + }, +} as ComponentMeta<typeof FooterComponent>; + +const Template: ComponentStory<typeof FooterComponent> = (args) => ( + <FooterComponent {...args} /> +); + +/** + * Layout Stories - Footer + */ +export const Footer = Template.bind({}); +Footer.args = { + children: 'The footer content.', +}; diff --git a/src/components/atoms/layout/footer/footer.test.tsx b/src/components/atoms/layout/footer/footer.test.tsx new file mode 100644 index 0000000..15c6e6d --- /dev/null +++ b/src/components/atoms/layout/footer/footer.test.tsx @@ -0,0 +1,13 @@ +import { describe, expect, it } from '@jest/globals'; +import { render, screen as rtlScreen } from '@testing-library/react'; +import { Footer } from './footer'; + +describe('Footer', () => { + it('renders the contents of a footer', () => { + const children = 'The footer content.'; + + render(<Footer>{children}</Footer>); + + expect(rtlScreen.getByRole('contentinfo')).toHaveTextContent(children); + }); +}); diff --git a/src/components/atoms/layout/footer/footer.tsx b/src/components/atoms/layout/footer/footer.tsx new file mode 100644 index 0000000..deb3956 --- /dev/null +++ b/src/components/atoms/layout/footer/footer.tsx @@ -0,0 +1,23 @@ +import { + type ForwardRefRenderFunction, + type HTMLAttributes, + type ReactNode, + forwardRef, +} from 'react'; + +export type FooterProps = HTMLAttributes<HTMLElement> & { + /** + * The footer contents. + */ + children: ReactNode; +}; + +const FooterWithRef: ForwardRefRenderFunction<HTMLElement, FooterProps> = ( + props, + ref +) => <footer {...props} ref={ref} />; + +/** + * Footer component. + */ +export const Footer = forwardRef(FooterWithRef); diff --git a/src/components/atoms/layout/footer/index.ts b/src/components/atoms/layout/footer/index.ts new file mode 100644 index 0000000..a058eae --- /dev/null +++ b/src/components/atoms/layout/footer/index.ts @@ -0,0 +1 @@ +export * from './footer'; |
