From ff3a251e75fafce7d95177010401483127973313 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 12 Apr 2022 15:48:47 +0200
Subject: chore: add a MainNavButton component

I also move the active state from the hamburger to this pseudo-button.
It makes more sense that the button handles the icon shape.
---
 .../molecules/buttons/main-nav-button.stories.tsx  | 80 ++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 src/components/molecules/buttons/main-nav-button.stories.tsx

(limited to 'src/components/molecules/buttons/main-nav-button.stories.tsx')

diff --git a/src/components/molecules/buttons/main-nav-button.stories.tsx b/src/components/molecules/buttons/main-nav-button.stories.tsx
new file mode 100644
index 0000000..39e495c
--- /dev/null
+++ b/src/components/molecules/buttons/main-nav-button.stories.tsx
@@ -0,0 +1,80 @@
+import { ComponentMeta, ComponentStory } from '@storybook/react';
+import { useState } from 'react';
+import { IntlProvider } from 'react-intl';
+import MainNavButtonComponent from './main-nav-button';
+
+export default {
+  title: 'Molecules/Buttons',
+  component: MainNavButtonComponent,
+  argTypes: {
+    checkboxClassName: {
+      control: {
+        type: 'text',
+      },
+      description: 'Set additional classnames to the checkbox.',
+      table: {
+        category: 'Styles',
+      },
+      type: {
+        name: 'string',
+        required: false,
+      },
+    },
+    isActive: {
+      control: {
+        type: null,
+      },
+      description: 'The button state.',
+      type: {
+        name: 'boolean',
+        required: true,
+      },
+    },
+    labelClassName: {
+      control: {
+        type: 'text',
+      },
+      description: 'Set additional classnames to the label.',
+      table: {
+        category: 'Styles',
+      },
+      type: {
+        name: 'string',
+        required: false,
+      },
+    },
+    setIsActive: {
+      control: {
+        type: null,
+      },
+      description: 'A callback function to set the button state.',
+      type: {
+        name: 'function',
+        required: true,
+      },
+    },
+  },
+} as ComponentMeta<typeof MainNavButtonComponent>;
+
+const Template: ComponentStory<typeof MainNavButtonComponent> = ({
+  isActive,
+  setIsActive: _setIsActive,
+  ...args
+}) => {
+  const [isChecked, setIsChecked] = useState<boolean>(isActive);
+
+  return (
+    <IntlProvider locale="en">
+      <MainNavButtonComponent
+        isActive={isChecked}
+        setIsActive={setIsChecked}
+        {...args}
+      />
+    </IntlProvider>
+  );
+};
+
+export const MainNavButton = Template.bind({});
+MainNavButton.args = {
+  isActive: false,
+};
-- 
cgit v1.2.3

