From a46f8f9ffeb2c32ca21d58ce13bff189fec84cb0 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 4 Apr 2022 14:48:05 +0200 Subject: chore: add a Logo component --- src/components/atoms/images/logo.module.scss | 28 +++++++++++++++++ src/components/atoms/images/logo.stories.tsx | 13 ++++++++ src/components/atoms/images/logo.test.tsx | 9 ++++++ src/components/atoms/images/logo.tsx | 46 ++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 src/components/atoms/images/logo.module.scss create mode 100644 src/components/atoms/images/logo.stories.tsx create mode 100644 src/components/atoms/images/logo.test.tsx create mode 100644 src/components/atoms/images/logo.tsx (limited to 'src/components/atoms/images') diff --git a/src/components/atoms/images/logo.module.scss b/src/components/atoms/images/logo.module.scss new file mode 100644 index 0000000..f802a4b --- /dev/null +++ b/src/components/atoms/images/logo.module.scss @@ -0,0 +1,28 @@ +@use "@styles/abstracts/functions" as fun; + +.wrapper { + width: var(--logo-size, fun.convert-px(100)); + height: var(--logo-size, fun.convert-px(100)); + max-width: 100%; + max-height: 100%; +} + +.bg-left { + fill: var(--color-primary-light); +} + +.bg-right { + fill: var(--color-primary-dark); +} + +.letter { + fill: var(--color-fg-inverted); + stroke: var(--color-primary-darker); + stroke-width: 5; +} + +.letter-shadow { + fill: var(--color-shadow-darker); + stroke: var(--color-shadow-darker); + stroke-width: 5; +} diff --git a/src/components/atoms/images/logo.stories.tsx b/src/components/atoms/images/logo.stories.tsx new file mode 100644 index 0000000..afb5317 --- /dev/null +++ b/src/components/atoms/images/logo.stories.tsx @@ -0,0 +1,13 @@ +import { ComponentMeta, ComponentStory } from '@storybook/react'; +import LogoComponent from './logo'; + +export default { + title: 'Atoms/Images', + component: LogoComponent, +} as ComponentMeta; + +const Template: ComponentStory = (args) => ( + +); + +export const Logo = Template.bind({}); diff --git a/src/components/atoms/images/logo.test.tsx b/src/components/atoms/images/logo.test.tsx new file mode 100644 index 0000000..3e0d238 --- /dev/null +++ b/src/components/atoms/images/logo.test.tsx @@ -0,0 +1,9 @@ +import { render, screen } from '@test-utils'; +import Logo from './logo'; + +describe('Logo', () => { + it('renders a logo with a title', () => { + render(); + expect(screen.getByTitle('My title')).toBeInTheDocument(); + }); +}); diff --git a/src/components/atoms/images/logo.tsx b/src/components/atoms/images/logo.tsx new file mode 100644 index 0000000..9ce2518 --- /dev/null +++ b/src/components/atoms/images/logo.tsx @@ -0,0 +1,46 @@ +import { FC } from 'react'; +import styles from './logo.module.scss'; + +type LogoProps = { + /** + * SVG Image title. + */ + title?: string; +}; + +/** + * Logo component. + * + * Render a SVG logo. + */ +const Logo: FC = ({ title }) => { + return ( + + {title && {title}} + + + + + + + + ); +}; + +export default Logo; -- cgit v1.2.3