From 4bd651b9e32c568d86b30463858c20ef290d8c07 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Thu, 7 Apr 2022 22:54:27 +0200
Subject: chore: add a HeadingButton component

---
 .../molecules/buttons/heading-button.stories.tsx   | 75 ++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 src/components/molecules/buttons/heading-button.stories.tsx

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

diff --git a/src/components/molecules/buttons/heading-button.stories.tsx b/src/components/molecules/buttons/heading-button.stories.tsx
new file mode 100644
index 0000000..0a23b08
--- /dev/null
+++ b/src/components/molecules/buttons/heading-button.stories.tsx
@@ -0,0 +1,75 @@
+import { ComponentMeta, ComponentStory } from '@storybook/react';
+import { useState } from 'react';
+import { IntlProvider } from 'react-intl';
+import HeadingButtonComponent from './heading-button';
+
+export default {
+  title: 'Molecules/Buttons',
+  component: HeadingButtonComponent,
+  argTypes: {
+    expanded: {
+      control: {
+        type: null,
+      },
+      description: 'Heading button state (plus or minus).',
+      type: {
+        name: 'boolean',
+        required: true,
+      },
+    },
+    level: {
+      control: {
+        type: 'number',
+      },
+      description: 'Heading level.',
+      type: {
+        name: 'number',
+        required: true,
+      },
+    },
+    setExpanded: {
+      control: {
+        type: null,
+      },
+      description: 'Callback function to set heading button state.',
+      type: {
+        name: 'function',
+        required: true,
+      },
+    },
+    title: {
+      control: {
+        type: 'text',
+      },
+      description: 'Heading title.',
+      type: {
+        name: 'string',
+        required: true,
+      },
+    },
+  },
+} as ComponentMeta<typeof HeadingButtonComponent>;
+
+const Template: ComponentStory<typeof HeadingButtonComponent> = ({
+  expanded,
+  setExpanded: _setExpanded,
+  ...args
+}) => {
+  const [isExpanded, setIsExpanded] = useState<boolean>(expanded);
+
+  return (
+    <IntlProvider locale="en">
+      <HeadingButtonComponent
+        expanded={isExpanded}
+        setExpanded={setIsExpanded}
+        {...args}
+      />
+    </IntlProvider>
+  );
+};
+
+export const HeadingButton = Template.bind({});
+HeadingButton.args = {
+  level: 2,
+  title: 'Your title',
+};
-- 
cgit v1.2.3

