From 0f936ec0e7606cb79434d94096b6e113a7ce78eb Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 15 Dec 2023 18:35:16 +0100
Subject: refactor(stories): migrate stories to CSF3 format

---
 src/components/atoms/links/link/link.stories.tsx | 222 +++++++----------------
 1 file changed, 64 insertions(+), 158 deletions(-)

(limited to 'src/components/atoms/links/link/link.stories.tsx')

diff --git a/src/components/atoms/links/link/link.stories.tsx b/src/components/atoms/links/link/link.stories.tsx
index 0a6a6c5..30b0eab 100644
--- a/src/components/atoms/links/link/link.stories.tsx
+++ b/src/components/atoms/links/link/link.stories.tsx
@@ -1,178 +1,84 @@
-import type { ComponentMeta, ComponentStory } from '@storybook/react';
+import type { Meta, StoryObj } from '@storybook/react';
 import { Link } from './link';
 
-/**
- * Link - Storybook Meta
- */
-export default {
-  title: 'Atoms/Links/Link',
+const meta = {
   component: Link,
-  argTypes: {
-    children: {
-      control: {
-        type: 'text',
-      },
-      description: 'The link body.',
-      type: {
-        name: 'string',
-        required: true,
-      },
-    },
-    className: {
-      control: {
-        type: 'text',
-      },
-      description: 'Set additional classnames.',
-      table: {
-        category: 'Styles',
-      },
-      type: {
-        name: 'string',
-        required: false,
-      },
-    },
-    href: {
-      control: {
-        type: 'text',
-      },
-      description: 'The link target.',
-      type: {
-        name: 'string',
-        required: true,
-      },
-    },
-    isDownload: {
-      control: {
-        type: 'boolean',
-      },
-      description: 'Determine if the link purpose is to download a file.',
-      table: {
-        category: 'Options',
-        defaultValue: { summary: false },
-      },
-      type: {
-        name: 'boolean',
-        required: false,
-      },
-    },
-    isExternal: {
-      control: {
-        type: 'boolean',
-      },
-      description: 'Determine if the link is external of the current website.',
-      table: {
-        category: 'Options',
-        defaultValue: { summary: false },
-      },
-      type: {
-        name: 'boolean',
-        required: false,
-      },
-    },
-    lang: {
-      control: {
-        type: 'text',
-      },
-      table: {
-        category: 'Options',
-      },
-      description: 'The target language as code language.',
-      type: {
-        name: 'string',
-        required: false,
-      },
-    },
-  },
-} as ComponentMeta<typeof Link>;
+  title: 'Atoms/Links',
+} satisfies Meta<typeof Link>;
+
+export default meta;
 
-const Template: ComponentStory<typeof Link> = (args) => <Link {...args} />;
+type Story = StoryObj<typeof meta>;
 
-/**
- * Links Stories - Default
- */
-export const Default = Template.bind({});
-Default.args = {
-  children: 'A link',
-  href: '#',
+export const Default: Story = {
+  args: {
+    children: 'A link',
+    href: '#link',
+  },
 };
 
-/**
- * Links Stories - Download
- */
-export const DownloadLink = Template.bind({});
-DownloadLink.args = {
-  children: 'A link to a file',
-  href: '#',
-  isDownload: true,
-  isExternal: false,
+export const WithLang: Story = {
+  args: {
+    children: 'Github repository',
+    href: 'https://github.com/ArmandPhilippot/apcom',
+    lang: 'en',
+  },
+  render: (args) => (
+    <>
+      Go to the <Link {...args} />.
+    </>
+  ),
 };
 
-/**
- * Links Stories - Download link with lang
- */
-export const DownloadLinkWithLang = Template.bind({});
-DownloadLinkWithLang.args = {
-  children: 'A link to a file',
-  href: '#',
-  isDownload: true,
-  isExternal: false,
-  lang: 'en',
+export const DownloadLink: Story = {
+  args: {
+    children: 'Download the file',
+    href: '#file',
+    isDownload: true,
+  },
 };
 
-/**
- * Links Stories - External
- */
-export const ExternalLink = Template.bind({});
-ExternalLink.args = {
-  children: 'A link',
-  href: '#',
-  isDownload: false,
-  isExternal: true,
+export const DownloadLinkWithLang: Story = {
+  args: {
+    children: 'Download the file',
+    href: '#file',
+    isDownload: true,
+    lang: 'en',
+  },
 };
 
-/**
- * Links Stories - External download link
- */
-export const ExternalDownload = Template.bind({});
-ExternalDownload.args = {
-  children: 'A link',
-  href: '#',
-  isDownload: true,
-  isExternal: true,
+export const ExternalLink: Story = {
+  args: {
+    children: 'Go to the Github repository',
+    href: 'https://github.com/ArmandPhilippot/apcom',
+    isExternal: true,
+  },
 };
 
-/**
- * Links Stories - External link with Lang
- */
-export const ExternalLinkWithLang = Template.bind({});
-ExternalLinkWithLang.args = {
-  children: 'A link',
-  href: '#',
-  isDownload: false,
-  isExternal: true,
-  lang: 'en',
+export const ExternalLinkWithLang: Story = {
+  args: {
+    children: 'Go to the Github repository',
+    href: 'https://github.com/ArmandPhilippot/apcom',
+    isExternal: true,
+    lang: 'en',
+  },
 };
 
-/**
- * Links Stories - External download with lang
- */
-export const ExternalDownloadWithLang = Template.bind({});
-ExternalDownloadWithLang.args = {
-  children: 'A link',
-  href: '#',
-  isDownload: true,
-  isExternal: true,
-  lang: 'en',
+export const ExternalDownloadLink: Story = {
+  args: {
+    children: 'Download the file',
+    href: '#file',
+    isDownload: true,
+    isExternal: true,
+  },
 };
 
-/**
- * Links Stories - With Lang
- */
-export const LinkLang = Template.bind({});
-LinkLang.args = {
-  children: 'A link',
-  href: '#',
-  isDownload: false,
-  isExternal: false,
-  lang: 'en',
+export const ExternalDownloadLinkWithLang: Story = {
+  args: {
+    children: 'Download the file',
+    href: '#file',
+    isDownload: true,
+    isExternal: true,
+    lang: 'en',
+  },
 };
-- 
cgit v1.2.3

