aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/meta-list/meta-list.stories.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-10 19:37:51 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commitc87c615b5866b8a8f361eeb0764bfdea85740e90 (patch)
treec27bda05fd96bbe3154472e170ba1abd5f9ea499 /src/components/molecules/meta-list/meta-list.stories.tsx
parent15522ec9146f6f1956620355c44dea2a6a75b67c (diff)
refactor(components): replace Meta component with MetaList
It removes items complexity by allowing consumers to use any label/value association. Translations should also be defined by the consumer. Each item can now be configured separately (borders, layout...).
Diffstat (limited to 'src/components/molecules/meta-list/meta-list.stories.tsx')
-rw-r--r--src/components/molecules/meta-list/meta-list.stories.tsx70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/components/molecules/meta-list/meta-list.stories.tsx b/src/components/molecules/meta-list/meta-list.stories.tsx
new file mode 100644
index 0000000..463ec96
--- /dev/null
+++ b/src/components/molecules/meta-list/meta-list.stories.tsx
@@ -0,0 +1,70 @@
+import type { ComponentMeta, ComponentStory } from '@storybook/react';
+import { Link } from '../../atoms';
+import { type MetaItemData, MetaList } from './meta-list';
+
+/**
+ * MetaList - Storybook Meta
+ */
+export default {
+ title: 'Molecules/MetaList',
+ component: MetaList,
+ argTypes: {
+ items: {
+ description: 'The meta items.',
+ type: {
+ name: 'object',
+ required: true,
+ value: {},
+ },
+ },
+ },
+} as ComponentMeta<typeof MetaList>;
+
+const Template: ComponentStory<typeof MetaList> = (args) => (
+ <MetaList {...args} />
+);
+
+const items: MetaItemData[] = [
+ { id: 'comments', label: 'Comments', value: 'No comments.' },
+ {
+ id: 'category',
+ label: 'Category',
+ value: <Link href="#cat1">Cat 1</Link>,
+ },
+ {
+ id: 'tags',
+ label: 'Tags',
+ value: [
+ { id: 'tag1', value: <Link href="#tag1">Tag 1</Link> },
+ { id: 'tag2', value: <Link href="#tag2">Tag 2</Link> },
+ ],
+ },
+ {
+ hasBorderedValues: true,
+ hasInlinedValues: true,
+ id: 'technologies',
+ label: 'Technologies',
+ value: [
+ { id: 'techno1', value: 'HTML' },
+ { id: 'techno2', value: 'CSS' },
+ { id: 'techno3', value: 'Javascript' },
+ ],
+ },
+];
+
+/**
+ * MetaList Stories - Default
+ */
+export const Default = Template.bind({});
+Default.args = {
+ items,
+};
+
+/**
+ * MetaList Stories - Inlined
+ */
+export const Inlined = Template.bind({});
+Inlined.args = {
+ isInline: true,
+ items,
+};