From d9bf6f0d69ecb4475c06c772ef6314e5a7ee0fe8 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 15 Apr 2022 16:32:55 +0200
Subject: chore: add a LinksListWidget component

---
 .../widgets/links-list-widget.stories.tsx          | 92 ++++++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 src/components/organisms/widgets/links-list-widget.stories.tsx

(limited to 'src/components/organisms/widgets/links-list-widget.stories.tsx')

diff --git a/src/components/organisms/widgets/links-list-widget.stories.tsx b/src/components/organisms/widgets/links-list-widget.stories.tsx
new file mode 100644
index 0000000..528f6f7
--- /dev/null
+++ b/src/components/organisms/widgets/links-list-widget.stories.tsx
@@ -0,0 +1,92 @@
+import { ComponentMeta, ComponentStory } from '@storybook/react';
+import { IntlProvider } from 'react-intl';
+import LinksListWidget from './links-list-widget';
+
+export default {
+  title: 'Organisms/Widgets',
+  component: LinksListWidget,
+  args: {
+    kind: 'unordered',
+  },
+  argTypes: {
+    items: {
+      description: 'The widget data.',
+      type: {
+        name: 'object',
+        required: true,
+        value: {},
+      },
+    },
+    kind: {
+      control: {
+        type: 'select',
+      },
+      description: 'The list kind: either ordered or unordered.',
+      options: ['ordered', 'unordered'],
+      table: {
+        category: 'Options',
+        defaultValue: { summary: 'unordered' },
+      },
+      type: {
+        name: 'string',
+        required: false,
+      },
+    },
+    level: {
+      control: {
+        type: 'number',
+      },
+      description: 'The heading level.',
+      type: {
+        name: 'number',
+        required: true,
+      },
+    },
+    title: {
+      control: {
+        type: 'text',
+      },
+      description: 'The widget title.',
+      type: {
+        name: 'string',
+        required: true,
+      },
+    },
+  },
+} as ComponentMeta<typeof LinksListWidget>;
+
+const Template: ComponentStory<typeof LinksListWidget> = (args) => (
+  <IntlProvider locale="en">
+    <LinksListWidget {...args} />
+  </IntlProvider>
+);
+
+const items = [
+  { name: 'Level 1: Item 1', url: '#' },
+  {
+    name: 'Level 1: Item 2',
+    url: '#',
+    child: [
+      { name: 'Level 2: Item 1', url: '#' },
+      { name: 'Level 2: Item 2', url: '#' },
+      {
+        name: 'Level 2: Item 3',
+        url: '#',
+        child: [
+          { name: 'Level 3: Item 1', url: '#' },
+          { name: 'Level 3: Item 2', url: '#' },
+        ],
+      },
+      { name: 'Level 2: Item 4', url: '#' },
+    ],
+  },
+  { name: 'Level 1: Item 3', url: '#' },
+  { name: 'Level 1: Item 4', url: '#' },
+];
+
+export const LinksList = Template.bind({});
+LinksList.args = {
+  items,
+  level: 2,
+  title: 'A list of links',
+};
-- 
cgit v1.2.3

