aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/meta-list/meta-list.stories.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-11-20 11:02:20 +0100
committerArmand Philippot <git@armandphilippot.com>2023-11-20 19:20:21 +0100
commitd5ade2359539648845a5854ed353b29367961d74 (patch)
tree45a49d90090408887135a971a7fd79c45d9dcd94 /src/components/molecules/meta-list/meta-list.stories.tsx
parent6ab9635a22d69186c8a24181ad5df7736e288577 (diff)
refactor(components): extract MetaItem from MetaList
* replace `items` prop on MetaList with `children` prop: it was too restrictive and the global options was not really useful. It is better too give control to the consumers.
Diffstat (limited to 'src/components/molecules/meta-list/meta-list.stories.tsx')
-rw-r--r--src/components/molecules/meta-list/meta-list.stories.tsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/components/molecules/meta-list/meta-list.stories.tsx b/src/components/molecules/meta-list/meta-list.stories.tsx
index 463ec96..d73c5b9 100644
--- a/src/components/molecules/meta-list/meta-list.stories.tsx
+++ b/src/components/molecules/meta-list/meta-list.stories.tsx
@@ -1,6 +1,7 @@
import type { ComponentMeta, ComponentStory } from '@storybook/react';
import { Link } from '../../atoms';
-import { type MetaItemData, MetaList } from './meta-list';
+import { MetaItem } from './meta-item';
+import { MetaList } from './meta-list';
/**
* MetaList - Storybook Meta
@@ -24,7 +25,7 @@ const Template: ComponentStory<typeof MetaList> = (args) => (
<MetaList {...args} />
);
-const items: MetaItemData[] = [
+const items = [
{ id: 'comments', label: 'Comments', value: 'No comments.' },
{
id: 'category',
@@ -57,7 +58,7 @@ const items: MetaItemData[] = [
*/
export const Default = Template.bind({});
Default.args = {
- items,
+ children: items.map(({ id, ...item }) => <MetaItem key={id} {...item} />),
};
/**
@@ -65,6 +66,6 @@ Default.args = {
*/
export const Inlined = Template.bind({});
Inlined.args = {
+ children: items.map(({ id, ...item }) => <MetaItem key={id} {...item} />),
isInline: true,
- items,
};