aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/images
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-04-04 14:48:05 +0200
committerArmand Philippot <git@armandphilippot.com>2022-04-04 15:19:18 +0200
commita46f8f9ffeb2c32ca21d58ce13bff189fec84cb0 (patch)
treedba2229e68896c1a4e7d8784b606eaa3a625ce8f /src/components/atoms/images
parent9b445e635e2694c0d6095a1a2613fc59314dc595 (diff)
chore: add a Logo component
Diffstat (limited to 'src/components/atoms/images')
-rw-r--r--src/components/atoms/images/logo.module.scss28
-rw-r--r--src/components/atoms/images/logo.stories.tsx13
-rw-r--r--src/components/atoms/images/logo.test.tsx9
-rw-r--r--src/components/atoms/images/logo.tsx46
4 files changed, 96 insertions, 0 deletions
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<typeof LogoComponent>;
+
+const Template: ComponentStory<typeof LogoComponent> = (args) => (
+ <LogoComponent {...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(<Logo title="My title" />);
+ 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<LogoProps> = ({ title }) => {
+ return (
+ <svg
+ viewBox="0 0 512 512"
+ xmlns="http://www.w3.org/2000/svg"
+ className={styles.wrapper}
+ >
+ {title && <title>{title}</title>}
+ <path className={styles['bg-left']} d="M 0,0 H 506 L 0,506 Z" />
+ <path className={styles['bg-right']} d="M 512,512 H 6 L 512,6 Z" />
+ <path
+ className={styles['letter-shadow']}
+ d="m 66.049088,353.26557 h 57.233082 l 15.4763,-40.00476 h 56.64908 l 15.76831,40.00476 h 57.2331 L 196.28357,165.21398 h -58.10911 z m 80.009522,-79.42552 21.02441,-55.18904 21.02439,55.18904 z"
+ />
+ <path
+ className={styles['letter']}
+ d="m 59.569539,346.78602 h 57.233081 l 15.4763,-40.00476 H 188.928 l 15.76831,40.00476 h 57.2331 L 189.80402,158.73443 h -58.10911 z m 80.009521,-79.42552 21.02441,-55.18904 21.02439,55.18904 z"
+ />
+ <path
+ className={styles['letter-shadow']}
+ d="m 288.84935,353.26557 h 54.89704 v -50.51696 h 40.88078 c 42.04881,0 68.91332,-28.61654 68.91332,-68.32931 0,-38.5447 -21.60841,-69.20532 -67.74528,-69.20532 h -96.94586 z m 54.89704,-92.56578 v -53.437 h 29.78458 c 16.35231,0 23.94446,10.51221 23.94446,27.15651 0,15.47629 -8.46817,26.28049 -25.40449,26.28049 z"
+ />
+ <path
+ className={styles['letter']}
+ d="m 282.3698,346.78602 h 54.89704 v -50.51696 h 40.88078 c 42.04881,0 68.91332,-28.61654 68.91332,-68.3293 0,-38.54471 -21.60841,-69.20533 -67.74528,-69.20533 H 282.3698 Z m 54.89704,-92.56578 v -53.437 h 29.78458 c 16.35231,0 23.94446,10.51221 23.94446,27.15652 0,15.47628 -8.46817,26.28048 -25.40449,26.28048 z"
+ />
+ </svg>
+ );
+};
+
+export default Logo;