@marigold/components 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/ActionGroup/ActionGroup.d.ts +9 -0
  2. package/dist/ActionGroup/index.d.ts +1 -0
  3. package/dist/Alert/Alert.d.ts +16 -1
  4. package/dist/Box/Box.d.ts +2 -1
  5. package/dist/Button/Button.d.ts +4 -6
  6. package/dist/Card/Card.d.ts +9 -0
  7. package/dist/Card/index.d.ts +1 -0
  8. package/dist/Checkbox/Checkbox.d.ts +3 -0
  9. package/dist/Checkbox/CheckboxIcons.d.ts +9 -0
  10. package/dist/Column/Column.d.ts +3 -1
  11. package/dist/Dialog/Dialog.d.ts +8 -1
  12. package/dist/Dialog/ModalDialog.d.ts +5 -0
  13. package/dist/Field/Field.d.ts +4 -2
  14. package/dist/Label/Label.d.ts +2 -1
  15. package/dist/Provider/MarigoldProvider.d.ts +3 -0
  16. package/dist/Provider/index.d.ts +3 -0
  17. package/dist/Radio/Radio.d.ts +3 -0
  18. package/dist/Radio/RadioIcons.d.ts +9 -0
  19. package/dist/Select/ListBox.d.ts +8 -0
  20. package/dist/Select/ListBoxSection.d.ts +8 -0
  21. package/dist/Select/Option.d.ts +8 -0
  22. package/dist/Select/Popover.d.ts +9 -0
  23. package/dist/Select/Select.d.ts +11 -4
  24. package/dist/Stack/Stack.d.ts +1 -3
  25. package/dist/Textarea/Textarea.d.ts +2 -1
  26. package/dist/components.cjs.development.js +868 -357
  27. package/dist/components.cjs.development.js.map +1 -1
  28. package/dist/components.cjs.production.min.js +1 -1
  29. package/dist/components.cjs.production.min.js.map +1 -1
  30. package/dist/components.esm.js +837 -359
  31. package/dist/components.esm.js.map +1 -1
  32. package/dist/index.d.ts +4 -0
  33. package/package.json +18 -3
  34. package/src/ActionGroup/ActionGroup.stories.mdx +62 -0
  35. package/src/ActionGroup/ActionGroup.test.tsx +83 -0
  36. package/src/ActionGroup/ActionGroup.tsx +43 -0
  37. package/src/ActionGroup/index.ts +1 -0
  38. package/src/Alert/Alert.stories.mdx +28 -38
  39. package/src/Alert/Alert.test.tsx +1 -1
  40. package/src/Alert/Alert.tsx +11 -33
  41. package/src/Badge/Badge.stories.mdx +48 -34
  42. package/src/Badge/Badge.test.tsx +7 -15
  43. package/src/Badge/Badge.tsx +1 -2
  44. package/src/Box/Box.stories.mdx +322 -26
  45. package/src/Box/Box.tsx +58 -50
  46. package/src/Button/Button.stories.mdx +54 -166
  47. package/src/Button/Button.test.tsx +48 -8
  48. package/src/Button/Button.tsx +47 -18
  49. package/src/Card/Card.stories.mdx +49 -0
  50. package/src/Card/Card.test.tsx +66 -0
  51. package/src/Card/Card.tsx +36 -0
  52. package/src/Card/index.ts +1 -0
  53. package/src/Checkbox/Checkbox.stories.mdx +76 -71
  54. package/src/Checkbox/Checkbox.test.tsx +70 -24
  55. package/src/Checkbox/Checkbox.tsx +68 -49
  56. package/src/Checkbox/CheckboxIcons.tsx +49 -0
  57. package/src/Column/Column.stories.mdx +39 -64
  58. package/src/Column/Column.test.tsx +8 -0
  59. package/src/Column/Column.tsx +12 -2
  60. package/src/Columns/Columns.stories.mdx +58 -240
  61. package/src/Container/Container.stories.mdx +8 -25
  62. package/src/Dialog/Dialog.stories.mdx +65 -56
  63. package/src/Dialog/Dialog.test.tsx +64 -24
  64. package/src/Dialog/Dialog.tsx +64 -12
  65. package/src/Dialog/ModalDialog.tsx +47 -0
  66. package/src/Divider/Divider.stories.mdx +28 -34
  67. package/src/Field/Field.stories.mdx +88 -48
  68. package/src/Field/Field.test.tsx +31 -40
  69. package/src/Field/Field.tsx +26 -21
  70. package/src/Heading/Heading.stories.mdx +30 -82
  71. package/src/Hidden/Hidden.stories.mdx +29 -54
  72. package/src/Image/Image.stories.mdx +26 -30
  73. package/src/Input/Input.stories.mdx +52 -36
  74. package/src/Label/Label.stories.mdx +47 -29
  75. package/src/Label/Label.test.tsx +15 -1
  76. package/src/Label/Label.tsx +20 -7
  77. package/src/Link/Link.stories.mdx +36 -29
  78. package/src/Menu/Menu.stories.mdx +71 -39
  79. package/src/Menu/Menu.test.tsx +4 -4
  80. package/src/Menu/Menu.tsx +12 -14
  81. package/src/MenuItem/MenuItem.stories.mdx +32 -27
  82. package/src/MenuItem/MenuItem.test.tsx +15 -11
  83. package/src/MenuItem/MenuItem.tsx +7 -10
  84. package/src/Message/Message.stories.mdx +35 -35
  85. package/src/Message/Message.tsx +2 -10
  86. package/src/Provider/MarigoldProvider.test.tsx +126 -0
  87. package/src/Provider/MarigoldProvider.tsx +29 -0
  88. package/src/Provider/index.ts +3 -0
  89. package/src/Radio/Radio.stories.mdx +78 -92
  90. package/src/Radio/Radio.test.tsx +57 -15
  91. package/src/Radio/Radio.tsx +71 -51
  92. package/src/Radio/RadioIcons.tsx +39 -0
  93. package/src/Select/ListBox.tsx +39 -0
  94. package/src/Select/ListBoxSection.tsx +40 -0
  95. package/src/Select/Option.tsx +48 -0
  96. package/src/Select/Popover.tsx +50 -0
  97. package/src/Select/Select.stories.mdx +70 -36
  98. package/src/Select/Select.test.tsx +279 -35
  99. package/src/Select/Select.tsx +151 -18
  100. package/src/Slider/Slider.stories.mdx +22 -49
  101. package/src/Stack/Stack.stories.mdx +40 -94
  102. package/src/Stack/Stack.test.tsx +84 -65
  103. package/src/Stack/Stack.tsx +25 -41
  104. package/src/Text/Text.stories.mdx +52 -52
  105. package/src/Text/Text.tsx +13 -14
  106. package/src/Textarea/Textarea.stories.mdx +65 -56
  107. package/src/Textarea/Textarea.test.tsx +4 -5
  108. package/src/Textarea/Textarea.tsx +28 -37
  109. package/src/ValidationMessage/ValidationMessage.stories.mdx +26 -26
  110. package/src/ValidationMessage/ValidationMessage.test.tsx +4 -4
  111. package/src/ValidationMessage/ValidationMessage.tsx +11 -12
  112. package/src/index.ts +5 -0
@@ -1,40 +1,36 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
1
+ import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
2
2
  import { Image } from './Image';
3
3
  import image1 from '../../../images/src/type_logo.png';
4
- import image2 from '../../../images/src/Marigold_Logo_Hotelstyle.png';
5
4
 
6
- <Meta title="Components/Image" />
5
+ <Meta
6
+ title="Components/Image"
7
+ argTypes={{
8
+ variant: {
9
+ control: {
10
+ type: 'text',
11
+ },
12
+ description: 'there is only one variant',
13
+ table: {
14
+ defaultValue: {
15
+ summary: 'fullWidth',
16
+ },
17
+ },
18
+ },
19
+ alt: {
20
+ control: {
21
+ type: 'text',
22
+ },
23
+ description: 'Description text for screenreaders'
24
+ },
25
+ }}
26
+ />
7
27
 
8
28
  # Image
9
29
 
10
- ## Description
11
-
12
- With the Image component you can render an `img` element.
13
- The themeSection is `images` and the variant can be added with the variant prop which is `fullWidth` per default.
14
-
15
- ## Properties
16
-
17
- | Property | Type | Default |
18
- | :------------------- | :------- | :---------- |
19
- | `variant` (optional) | `string` | `fullWidth` |
20
- | `alt` (optional) | `string` | `` |
21
-
22
- ## Import
23
-
24
- ```tsx
25
- import { Image } from '@marigold/components';
26
- ```
27
-
28
- ## Usage
30
+ export const Template = args => <Image src={image1} alt="marigold_logo" />;
29
31
 
30
32
  <Canvas>
31
- <Story name="firstImage">
32
- <Image src={image1} alt="marigold_logo" />
33
- </Story>
33
+ <Story name="Default">{Template.bind({})}</Story>
34
34
  </Canvas>
35
35
 
36
- <Canvas>
37
- <Story name="secondImage">
38
- <Image src={image2} width="500" height="300" />
39
- </Story>
40
- </Canvas>
36
+ <ArgsTable story="Default" />
@@ -1,45 +1,61 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
1
+ import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
2
2
  import { Input } from './Input';
3
3
  import { Label } from '../Label';
4
4
 
5
- <Meta title="Components/Input" />
5
+ <Meta
6
+ title="Components/Input"
7
+ argTypes={{
8
+ variant: {
9
+ control: {
10
+ type: 'text',
11
+ },
12
+ description: '?',
13
+ table: {
14
+ defaultValue: {
15
+ summary: 'default',
16
+ },
17
+ },
18
+ },
19
+ type: {
20
+ control: {
21
+ type: 'select',
22
+ },
23
+ options: [
24
+ 'date',
25
+ 'datetime-local',
26
+ 'email',
27
+ 'month',
28
+ 'number',
29
+ 'password',
30
+ 'search',
31
+ 'tel',
32
+ 'text',
33
+ 'time',
34
+ 'time',
35
+ 'url',
36
+ 'week',
37
+ ],
38
+ type: { required: true },
39
+ table: {
40
+ defaultValue: {
41
+ summary: 'text',
42
+ },
43
+ },
44
+ },
45
+ }}
46
+ />
6
47
 
7
48
  # Input
8
49
 
9
- ## Description
10
-
11
- With the Input component you can add a HTML `<input>` field for different types of text to your form.
12
- The element uses always the themeSection with the name: `input` in your given theme. The variant in your section can be added with the variant prop. The default variant is `default`.
13
-
14
- ## Properties
15
-
16
- | Property | Type | Default |
17
- | :------------------- | :------- | :-------- |
18
- | `variant` (optional) | `string` | `default` |
19
-
20
- ## Import
21
-
22
- ```tsx
23
- import { Input } from '@marigold/components';
24
- ```
25
-
26
- ## Usage
50
+ export const Template = args => (
51
+ <Label htmlFor="input">
52
+ Label
53
+ <Input id="input" placeholder="Placeholder..." {...args} />
54
+ </Label>
55
+ );
27
56
 
28
57
  <Canvas>
29
- <Story name="Input">
30
- <div>
31
- <Label htmlFor="input">
32
- Label
33
- <Input id="input" placeholder="Placeholder" />
34
- </Label>
35
- <Label htmlFor="input2">
36
- Label
37
- <Input id="input2" placeholder="Disabled" disabled />
38
- </Label>
39
- <Label htmlFor="input3">
40
- Label
41
- <Input id="input2" type="submit" />
42
- </Label>
43
- </div>
44
- </Story>
58
+ <Story name="Default">{Template.bind({})}</Story>
45
59
  </Canvas>
60
+
61
+ <ArgsTable story="Default" />
@@ -1,34 +1,52 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
1
+ import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
2
2
  import { Label } from './Label';
3
3
 
4
- <Meta title="Components/Label" />
5
-
6
- # Label-Component
7
-
8
- ## Description
9
-
10
- With the Label component you can add a HTML `<Label>` element to your form.
11
- The element uses always the themeSection with the name: `label` in your given theme. The variant in your section can be added with the variant prop. The default variant is `default`.
12
-
13
- ## Properties
14
-
15
- | Property | Type | Default |
16
- | :------------------- | :------- | :-------- |
17
- | `variant` (optional) | `string` | `default` |
18
- | `htmlFor` | `string` | |
19
-
20
- ## Import
21
-
22
- ```tsx
23
- import { Label } from '@marigold/components';
24
- ```
25
-
26
- ## Usage
4
+ <Meta
5
+ title="Components/Label"
6
+ argTypes={{
7
+ variant: {
8
+ control: {
9
+ type: 'text',
10
+ },
11
+ description: '?',
12
+ table: {
13
+ defaultValue: {
14
+ summary: 'above',
15
+ },
16
+ },
17
+ },
18
+ htmlFor: {
19
+ control: {
20
+ type: 'text',
21
+ },
22
+ type: {
23
+ required: true,
24
+ },
25
+ },
26
+ required: {
27
+ control: {
28
+ type: 'boolean',
29
+ },
30
+ description: 'Adds required Icon to label',
31
+ table: {
32
+ defaultValue: {
33
+ summary: false,
34
+ },
35
+ },
36
+ },
37
+ }}
38
+ />
39
+
40
+ # Label
41
+
42
+ export const Template = args => (
43
+ <Label htmlFor="input" {...args}>
44
+ Label
45
+ </Label>
46
+ );
27
47
 
28
48
  <Canvas>
29
- <Story name="label">
30
- <Label variant="label" htmlFor="labelId">
31
- I am a Label!
32
- </Label>
33
- </Story>
49
+ <Story name="Default">{Template.bind({})}</Story>
34
50
  </Canvas>
51
+
52
+ <ArgsTable story="Default" />
@@ -5,7 +5,7 @@ import { Label } from './Label';
5
5
 
6
6
  const theme = {
7
7
  label: {
8
- default: {
8
+ above: {
9
9
  fontFamily: 'Inter Regular',
10
10
  },
11
11
  myLabel: {
@@ -49,6 +49,20 @@ test('supports htmlFor prop', () => {
49
49
  expect(label).toHaveAttribute('for');
50
50
  });
51
51
 
52
+ test('supports required prop', () => {
53
+ render(
54
+ <ThemeProvider theme={theme}>
55
+ <Label htmlFor="labelId" required>
56
+ label
57
+ </Label>
58
+ </ThemeProvider>
59
+ );
60
+ const label = screen.getByText(/label/);
61
+ const parent = label.parentElement;
62
+
63
+ expect(parent instanceof HTMLSpanElement).toBeTruthy();
64
+ });
65
+
52
66
  test('renders <label> element', () => {
53
67
  render(
54
68
  <ThemeProvider theme={theme}>
@@ -1,18 +1,31 @@
1
1
  import React from 'react';
2
2
  import { ComponentProps } from '@marigold/types';
3
+ import { Required } from '@marigold/icons';
4
+
3
5
  import { Box } from '../Box';
4
6
 
5
7
  export type LabelProps = {
6
- htmlFor: string;
8
+ htmlFor?: string;
7
9
  variant?: string;
10
+ required?: boolean;
8
11
  } & ComponentProps<'label'>;
9
12
 
10
13
  export const Label: React.FC<LabelProps> = ({
11
- variant = 'default',
14
+ variant = 'above',
15
+ required,
12
16
  children,
13
17
  ...props
14
- }) => (
15
- <Box {...props} as="label" variant={`label.${variant}`}>
16
- {children}
17
- </Box>
18
- );
18
+ }) => {
19
+ return required ? (
20
+ <Box as="span" display="inline-flex" alignItems="center">
21
+ <Box {...props} as="label" variant={`label.${variant}`}>
22
+ {children}
23
+ </Box>
24
+ {required && <Box as={Required} size={16} css={{ color: 'red60' }} />}
25
+ </Box>
26
+ ) : (
27
+ <Box {...props} as="label" variant={`label.${variant}`}>
28
+ {children}
29
+ </Box>
30
+ );
31
+ };
@@ -1,38 +1,45 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
1
+ import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
2
2
  import { Link } from './Link';
3
3
  import { Text } from '../Text';
4
4
 
5
- <Meta title="Components/Link" />
5
+ <Meta
6
+ title="Components/Link"
7
+ argTypes={{
8
+ variant: {
9
+ control: {
10
+ type: 'text',
11
+ },
12
+ description: '?',
13
+ table: {
14
+ defaultValue: {
15
+ summary: 'link',
16
+ },
17
+ },
18
+ },
19
+ href: {
20
+ control: {
21
+ type: 'text',
22
+ },
23
+ description: 'The URL to direct to',
24
+ type: {
25
+ required: true,
26
+ },
27
+ },
28
+ }}
29
+ />
6
30
 
7
31
  # Link
8
32
 
9
- ## Description
10
-
11
- Element to style links.
12
-
13
- ## Properties
14
-
15
- | Property | Type | Default |
16
- | :------------------- | :------- | :------ |
17
- | `variant` (optional) | `string` | `link` |
18
- | `href` | `string` | |
19
-
20
- ## Import
21
-
22
- ```tsx
23
- import { Link } from '@marigold/components';
24
- ```
25
-
26
- ## Usage
33
+ export const Template = args => (
34
+ <Text>
35
+ <Link href="https://marigold-ui.io" target="_blank">
36
+ Cool site
37
+ </Link>
38
+ </Text>
39
+ );
27
40
 
28
41
  <Canvas>
29
- <Story name="Link">
30
- <Text>
31
- Link something nice like{' '}
32
- <Link href="#!" target="_blank">
33
- Marigold
34
- </Link>{' '}
35
- in text.
36
- </Text>
37
- </Story>
42
+ <Story name="Default">{Template.bind({})}</Story>
38
43
  </Canvas>
44
+
45
+ <ArgsTable story="Default" />
@@ -1,49 +1,81 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
- import { Divider } from '../Divider';
1
+ import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
3
2
  import { Menu } from './Menu';
4
3
  import { MenuItem } from '../MenuItem';
5
4
  import { BurgerMenu } from '@marigold/icons';
5
+ import { useState } from 'react';
6
6
 
7
- <Meta title="Components/Menu" />
7
+ <Meta
8
+ title="Components/Menu"
9
+ parameters={{
10
+ actions: {
11
+ handles: ['click'],
12
+ },
13
+ }}
14
+ argTypes={{
15
+ variant: {
16
+ control: {
17
+ type: 'text',
18
+ },
19
+ description: '?',
20
+ table: {
21
+ defaultValue: {
22
+ summary: 'default',
23
+ },
24
+ },
25
+ },
26
+ label: {
27
+ control: {
28
+ type: 'text',
29
+ },
30
+ description: 'Menu label on hover',
31
+ table: {
32
+ defaultValue: {
33
+ summary: 'Menu',
34
+ },
35
+ },
36
+ },
37
+ show: {
38
+ control: {
39
+ type: 'boolean',
40
+ },
41
+ options: [true, false],
42
+ description: 'Show what',
43
+ table: {
44
+ defaultValue: {
45
+ summary: false,
46
+ },
47
+ },
48
+ },
49
+ onClick: {
50
+ control: {
51
+ type: 'text',
52
+ },
53
+ description: 'Function to show menu or toggle something',
54
+ type: { required: true },
55
+ },
56
+ }}
57
+ />
8
58
 
9
59
  # Menu
10
60
 
11
- ## Description
12
-
13
- With the Menu component you can add a Menu Button with Text or Icon as Label and as children some MenuItem components.
14
- The element uses always the themeSection with the name: `content` in your given theme. The variant in your section can be added with the variant prop. The default variant is `menu`.
15
-
16
- ## Properties
17
-
18
- | Property | Type | Default |
19
- | :------------------- | :--------- | :------ |
20
- | `variant` (optional) | `string` | `menu` |
21
- | `label` (optional) | `string` | `Menu` |
22
- | `onClick` | `function` | |
23
- | `show` (optional) | `boolean` | `false` |
24
-
25
- ## Import
26
-
27
- ```tsx
28
- import { Menu } from '@marigold/components';
29
- ```
30
-
31
- ## Usage
61
+ export const Template = ({ onClick, ...args }) => {
62
+ const [showMenu, setShowMenu] = React.useState(false);
63
+ return (
64
+ <Menu
65
+ onClick={() => setShowMenu(!showMenu)}
66
+ show={showMenu}
67
+ label={<BurgerMenu />}
68
+ {...args}
69
+ >
70
+ <MenuItem href="#">Home</MenuItem>
71
+ <MenuItem href="#">Tickets</MenuItem>
72
+ <MenuItem href="#">Logout</MenuItem>
73
+ </Menu>
74
+ );
75
+ };
32
76
 
33
77
  <Canvas>
34
- <Story name="menu">
35
- {() => {
36
- const [showMenu, setShowMenu] = React.useState(false);
37
- const toggle = () => {
38
- setShowMenu(!showMenu);
39
- };
40
- return (
41
- <Menu onClick={toggle} show={showMenu} label={<BurgerMenu />}>
42
- <MenuItem href="#">Home</MenuItem>
43
- <MenuItem href="#">Tickets</MenuItem>
44
- <MenuItem href="#">Kundenkonto</MenuItem>
45
- </Menu>
46
- );
47
- }}
48
- </Story>
78
+ <Story name="Mini menu">{Template.bind({})}</Story>
49
79
  </Canvas>
80
+
81
+ <ArgsTable story="Mini menu" />
@@ -5,11 +5,11 @@ import { Menu } from './Menu';
5
5
  import { MenuItem } from '../MenuItem';
6
6
 
7
7
  const theme = {
8
- content: {
9
- menu: {
8
+ menu: {
9
+ default: {
10
10
  padding: '4px',
11
11
  },
12
- options: {
12
+ custom: {
13
13
  padding: '8px',
14
14
  },
15
15
  },
@@ -31,7 +31,7 @@ test('supports default variant and themeSection', () => {
31
31
  test('accepts other variant than default', () => {
32
32
  render(
33
33
  <ThemeProvider theme={theme}>
34
- <Menu variant="options" title="menu" onClick={() => {}}>
34
+ <Menu variant="custom" title="menu" onClick={() => {}}>
35
35
  <MenuItem href="#">Home</MenuItem>
36
36
  </Menu>
37
37
  </ThemeProvider>
package/src/Menu/Menu.tsx CHANGED
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { useStyles } from '@marigold/system';
3
2
  import { ComponentProps } from '@marigold/types';
4
3
 
5
4
  import { Button } from '../Button';
@@ -15,29 +14,28 @@ export type MenuProps = {
15
14
  };
16
15
 
17
16
  export const Menu: React.FC<MenuProps> = ({
18
- variant = 'menu',
17
+ variant = 'default',
19
18
  label = 'Menu',
20
19
  onClick,
21
20
  show = false,
22
21
  children,
23
22
  ...props
24
23
  }) => {
25
- const itemStyles = useStyles({
26
- css: {
27
- position: 'absolute',
28
- minWidth: '120px',
29
- display: 'block',
30
- textAlign: 'left',
31
- borderRadius: '2px',
32
- },
33
- });
34
-
35
24
  return (
36
- <Box variant={`content.${variant}`} {...props}>
25
+ <Box variant={`menu.${variant}`} {...props}>
37
26
  <Button onClick={onClick} variant="menu">
38
27
  {label}
39
28
  </Button>
40
- {show ? <div className={itemStyles}>{children}</div> : null}
29
+ {show ? (
30
+ <Box
31
+ display="block"
32
+ position="absolute"
33
+ minWidth="120px"
34
+ borderRadius="2px"
35
+ >
36
+ {children}
37
+ </Box>
38
+ ) : null}
41
39
  </Box>
42
40
  );
43
41
  };
@@ -1,32 +1,37 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
1
+ import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
2
+ import { Menu } from '../Menu';
2
3
  import { MenuItem } from './MenuItem';
3
4
 
4
- <Meta title="Components/MenuItem" />
5
-
6
- # Menu
7
-
8
- ## Description
9
-
10
- With the MenuItem component you can add a MenuItem which renders a link component to a Menu component.
11
- The element uses always the themeSection with the name: `menu` in your given theme. The variant in your section can be added with the variant prop. The default variant is `menuItem`.
12
- The Link component in the MenuItem uses the variant `menu`.
13
-
14
- ## Properties
15
-
16
- | Property | Type | Default |
17
- | :------------------- | :------- | :--------- |
18
- | `variant` (optional) | `string` | `menuItem` |
19
-
20
- ## Import
21
-
22
- ```tsx
23
- import { MenuItem } from '@marigold/components';
24
- ```
25
-
26
- ## Usage
5
+ <Meta
6
+ title="Components/MenuItem"
7
+ parameters={{
8
+ actions: {
9
+ handles: ['click'],
10
+ },
11
+ }}
12
+ argTypes={{
13
+ variant: {
14
+ control: {
15
+ type: 'text',
16
+ },
17
+ description: '?',
18
+ table: {
19
+ defaultValue: {
20
+ summary: 'default',
21
+ },
22
+ },
23
+ },
24
+ }}
25
+ />
26
+
27
+ # Menu Item
28
+
29
+ export const Template = args => {
30
+ return <MenuItem href="#">Home</MenuItem>;
31
+ };
27
32
 
28
33
  <Canvas>
29
- <Story name="MenuItem">
30
- <MenuItem href="#">Menu Item</MenuItem>
31
- </Story>
34
+ <Story name="Menu Item">{Template.bind({})}</Story>
32
35
  </Canvas>
36
+
37
+ <ArgsTable story="Menu Item" />