@platformatic/ui-components 0.1.48 → 0.1.50

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 (152) hide show
  1. package/.github/workflows/ci.yml +26 -26
  2. package/.nvmrc +1 -1
  3. package/LICENSE +201 -201
  4. package/README.md +30 -30
  5. package/fonts/Montserrat/README.txt +81 -81
  6. package/index.html +12 -12
  7. package/index.js +71 -71
  8. package/package.json +76 -76
  9. package/postcss.config.cjs +8 -8
  10. package/public/api-icon-closed.svg +6 -6
  11. package/public/api-icon.svg +9 -9
  12. package/src/App.jsx +12 -12
  13. package/src/components/BorderedBox.jsx +18 -18
  14. package/src/components/BorderedBox.module.css +8 -8
  15. package/src/components/BorderedText.jsx +8 -8
  16. package/src/components/BorderedText.module.css +2 -2
  17. package/src/components/Box.jsx +14 -14
  18. package/src/components/Box.module.css +7 -7
  19. package/src/components/Button.jsx +95 -95
  20. package/src/components/Button.module.css +127 -127
  21. package/src/components/ButtonFullRounded.jsx +17 -17
  22. package/src/components/ButtonFullRounded.module.css +28 -28
  23. package/src/components/Checkbox.jsx +11 -11
  24. package/src/components/Checkbox.module.css +18 -18
  25. package/src/components/Common.module.css +28 -28
  26. package/src/components/DetailedMetric.jsx +32 -32
  27. package/src/components/DetailedMetric.module.css +2 -2
  28. package/src/components/DropDown.jsx +36 -36
  29. package/src/components/DropDown.module.css +27 -27
  30. package/src/components/FollowUs.jsx +35 -35
  31. package/src/components/FollowUs.module.css +11 -11
  32. package/src/components/GHLoginButton.jsx +14 -14
  33. package/src/components/HorizontalSeparator.jsx +15 -15
  34. package/src/components/HorizontalSeparator.module.css +26 -26
  35. package/src/components/InfoBox.jsx +50 -50
  36. package/src/components/InfoBox.module.css +5 -5
  37. package/src/components/List.jsx +20 -20
  38. package/src/components/List.module.css +11 -11
  39. package/src/components/ListElement.jsx +23 -23
  40. package/src/components/ListElement.module.css +23 -23
  41. package/src/components/Loadable.jsx +34 -34
  42. package/src/components/Loadable.module.css +13 -13
  43. package/src/components/Loader.jsx +22 -22
  44. package/src/components/Loader.module.css +13 -13
  45. package/src/components/LoginButton.jsx +17 -17
  46. package/src/components/LoginButton.module.css +7 -7
  47. package/src/components/LoginButton.test.jsx +25 -25
  48. package/src/components/Logo.jsx +62 -62
  49. package/src/components/Logo.module.css +5 -5
  50. package/src/components/Main.jsx +33 -33
  51. package/src/components/MetricValue.jsx +15 -15
  52. package/src/components/MetricValue.module.css +9 -9
  53. package/src/components/Modal.jsx +93 -93
  54. package/src/components/Modal.module.css +50 -50
  55. package/src/components/PlatformaticIcon.jsx +57 -57
  56. package/src/components/PlatformaticIcon.module.css +2 -2
  57. package/src/components/Playground.jsx +9 -9
  58. package/src/components/SearchBar.jsx +63 -63
  59. package/src/components/SearchBar.module.css +20 -20
  60. package/src/components/Sidebar.jsx +153 -153
  61. package/src/components/Sidebar.module.css +66 -66
  62. package/src/components/SimpleMetric.jsx +28 -28
  63. package/src/components/SimpleMetric.module.css +6 -6
  64. package/src/components/Status.jsx +26 -26
  65. package/src/components/TabbedWindow.jsx +39 -39
  66. package/src/components/TabbedWindow.module.css +16 -16
  67. package/src/components/TextWithLabel.jsx +11 -11
  68. package/src/components/TextWithLabel.module.css +8 -8
  69. package/src/components/Versions.jsx +9 -9
  70. package/src/components/VerticalSeparator.jsx +5 -5
  71. package/src/components/forms/Field.jsx +53 -20
  72. package/src/components/forms/Field.module.css +23 -17
  73. package/src/components/forms/Input.jsx +80 -87
  74. package/src/components/forms/Input.module.css +28 -28
  75. package/src/components/forms/Preview.jsx +75 -77
  76. package/src/components/forms/Preview.module.css +14 -14
  77. package/src/components/forms/ToggleSwitch.jsx +18 -18
  78. package/src/components/forms/ToggleSwitch.module.css +42 -42
  79. package/src/components/forms/index.js +8 -8
  80. package/src/components/icons/ApiEmptyIcon.jsx +107 -107
  81. package/src/components/icons/ApiIcon.jsx +29 -29
  82. package/src/components/icons/ApiIconClosed.jsx +19 -19
  83. package/src/components/icons/AppEmptyIcon.jsx +94 -94
  84. package/src/components/icons/AppIcon.jsx +38 -38
  85. package/src/components/icons/AppListIcon.jsx +73 -73
  86. package/src/components/icons/Calendar1Icon.jsx +54 -54
  87. package/src/components/icons/Calendar7Icon.jsx +55 -55
  88. package/src/components/icons/CalendarIcon.jsx +56 -56
  89. package/src/components/icons/CircleAddIcon.jsx +40 -40
  90. package/src/components/icons/CircleBackIcon.jsx +51 -51
  91. package/src/components/icons/CircleCheckMarkIcon.jsx +66 -0
  92. package/src/components/icons/CircleCloseHoverIcon.jsx +42 -42
  93. package/src/components/icons/CircleCloseIcon.jsx +32 -32
  94. package/src/components/icons/CircleExclamationIcon.jsx +29 -29
  95. package/src/components/icons/CloseIcon.jsx +31 -31
  96. package/src/components/icons/CopyIcon.jsx +75 -46
  97. package/src/components/icons/CreatedWorkspaceIcon.jsx +70 -70
  98. package/src/components/icons/DynamicWorkspaceIcon.jsx +125 -125
  99. package/src/components/icons/EditIcon.jsx +38 -0
  100. package/src/components/icons/GearIcon.jsx +40 -40
  101. package/src/components/icons/Icons.module.css +29 -29
  102. package/src/components/icons/LiveIcon.jsx +43 -43
  103. package/src/components/icons/MetricsIcon.jsx +52 -52
  104. package/src/components/icons/PlayIcon.jsx +20 -20
  105. package/src/components/icons/PullRequestIcon.jsx +35 -35
  106. package/src/components/icons/StaticWorkspaceIcon.jsx +119 -119
  107. package/src/components/icons/StopIcon.jsx +21 -21
  108. package/src/components/icons/TerminalIcon.jsx +22 -22
  109. package/src/components/icons/TriangleExclamationIcon.jsx +26 -26
  110. package/src/components/icons/UpgradeIcon.jsx +48 -48
  111. package/src/components/icons/index.js +63 -59
  112. package/src/components/layouts/Layout.jsx +11 -11
  113. package/src/components/layouts/TwoColumnsLayout.jsx +12 -12
  114. package/src/components/layouts/TwoColumnsLayout.module.css +9 -9
  115. package/src/hooks/useEscapeKey.js +20 -20
  116. package/src/lib/utils.js +23 -23
  117. package/src/main.jsx +9 -9
  118. package/src/stories/BorderedBox.stories.jsx +33 -33
  119. package/src/stories/BorderedText.stories.jsx +24 -24
  120. package/src/stories/Button.stories.jsx +114 -114
  121. package/src/stories/ButtonFullRounded.stories.jsx +61 -61
  122. package/src/stories/Checkbox.stories.jsx +27 -27
  123. package/src/stories/DetailedMetric.stories.jsx +33 -33
  124. package/src/stories/DropDown.stories.jsx +62 -62
  125. package/src/stories/FollowUs.stories.jsx +14 -14
  126. package/src/stories/GHLoginButton.stories.jsx +14 -14
  127. package/src/stories/HorizontalSeparator.stories.jsx +12 -12
  128. package/src/stories/InfoBox.stories.jsx +46 -46
  129. package/src/stories/Introduction.stories.mdx +211 -211
  130. package/src/stories/List.stories.jsx +29 -29
  131. package/src/stories/ListElement.stories.jsx +15 -15
  132. package/src/stories/Loadable.stories.jsx +75 -75
  133. package/src/stories/Loader.stories.jsx +44 -44
  134. package/src/stories/LoginButton.stories.jsx +15 -15
  135. package/src/stories/Logo.stories.jsx +17 -17
  136. package/src/stories/Modal.stories.jsx +100 -100
  137. package/src/stories/PlatformaticIcon.stories.jsx +51 -35
  138. package/src/stories/SearchBar.stories.jsx +28 -28
  139. package/src/stories/Sidebar.stories.jsx +61 -61
  140. package/src/stories/SimpleMetric.stories.jsx +41 -41
  141. package/src/stories/Status.stories.jsx +31 -31
  142. package/src/stories/TextWithLabel.stories.jsx +25 -25
  143. package/src/stories/TwoColumnsLayout.stories.jsx +42 -42
  144. package/src/stories/forms/Field.stories.jsx +89 -81
  145. package/src/stories/forms/Input.stories.jsx +89 -69
  146. package/src/stories/forms/Preview.stories.jsx +57 -57
  147. package/src/stories/forms/ToggleSwitch.stories.jsx +15 -15
  148. package/src/stories/icons/Icons.stories.jsx +74 -74
  149. package/src/styles/main.css +15 -15
  150. package/tailwind.config.cjs +60 -60
  151. package/vite.config.js +6 -6
  152. package/vitest.config.js +14 -14
@@ -1,114 +1,114 @@
1
- 'use strict'
2
- import { faCheck } from '@fortawesome/free-solid-svg-icons'
3
- import { useState } from 'react'
4
- import Button from '../components/Button'
5
-
6
- const colors = ['main-green', 'dark-green', 'light-green', 'main-dark-blue', 'dark-blue', 'light-blue', 'white', 'error-red', 'tertiary-blue', 'transparent']
7
-
8
- export default {
9
- title: 'Platformatic/Button',
10
- component: Button,
11
- argTypes: {
12
- label: {
13
- type: 'string',
14
- control: 'text'
15
- },
16
- bold: {
17
- type: 'boolean'
18
- },
19
- backgroundColor: {
20
- type: 'string',
21
- control: {
22
- type: 'radio',
23
- options: colors
24
- }
25
- },
26
- color: {
27
- type: 'string',
28
- control: {
29
- type: 'radio',
30
- options: colors
31
- }
32
- },
33
- disabled: {
34
- type: 'boolean'
35
- },
36
- size: {
37
- type: 'string',
38
- control: {
39
- type: 'radio',
40
- options: ['small', 'medium', 'large', 'extra-large']
41
- }
42
- },
43
- hoverEffect: {
44
- type: 'radio',
45
- options: ['hover', 'underline']
46
- },
47
- bordered: {
48
- type: 'boolean'
49
- },
50
- fullWidth: {
51
- type: 'boolean'
52
- }
53
- }
54
- }
55
-
56
- const Template = (args) => <Button {...args} />
57
-
58
- export const OnlyLabel = Template.bind({})
59
- // More on args: https://storybook.js.org/docs/react/writing-stories/args
60
- OnlyLabel.args = {
61
- label: 'Sample label',
62
- backgroundColor: 'main-green'
63
- }
64
-
65
- export const BorderedRed = Template.bind({})
66
- BorderedRed.args = {
67
- label: 'Borderer Red',
68
- color: 'error-red'
69
- }
70
-
71
- export const TransparentWhite = Template.bind({})
72
- TransparentWhite.args = {
73
- label: 'White',
74
- color: 'white',
75
- icon: faCheck
76
- }
77
-
78
- const DisabledTemplate = (args) => {
79
- const [enabled, setEnabled] = useState(false)
80
- return (
81
- <div className='flex flex-col gap-y-6 text-white'>
82
- <div>
83
- <Button {...args} disabled={!enabled} onClick={() => alert('clicked')} />
84
- <span className='ml-4 text-xl'>👈 This button is {enabled ? 'enabled' : 'disabled'}</span>
85
- </div>
86
- <div>
87
- <Button label='Toggle Disabled' backgroundColor='main-green' onClick={() => setEnabled(!enabled)} />
88
- </div>
89
- </div>
90
- )
91
- }
92
-
93
- export const DisabledGreen = DisabledTemplate.bind({})
94
-
95
- DisabledGreen.args = {
96
- backgroundColor: 'main-green',
97
- label: 'A simple button',
98
- color: 'main-dark-blue',
99
- disabled: true
100
- }
101
-
102
- export const DisabledRed = DisabledTemplate.bind({})
103
- DisabledRed.args = {
104
- label: 'A simple button',
105
- color: 'error-red',
106
- disabled: true
107
- }
108
-
109
- export const UsingPlatformaticIcon = Template.bind({})
110
- UsingPlatformaticIcon.args = {
111
- label: 'White',
112
- color: 'white',
113
- platformaticIcon: { iconName: 'GearIcon', color: 'white' }
114
- }
1
+ 'use strict'
2
+ import { faCheck } from '@fortawesome/free-solid-svg-icons'
3
+ import { useState } from 'react'
4
+ import Button from '../components/Button'
5
+
6
+ const colors = ['main-green', 'dark-green', 'light-green', 'main-dark-blue', 'dark-blue', 'light-blue', 'white', 'error-red', 'tertiary-blue', 'transparent']
7
+
8
+ export default {
9
+ title: 'Platformatic/Button',
10
+ component: Button,
11
+ argTypes: {
12
+ label: {
13
+ type: 'string',
14
+ control: 'text'
15
+ },
16
+ bold: {
17
+ type: 'boolean'
18
+ },
19
+ backgroundColor: {
20
+ type: 'string',
21
+ control: {
22
+ type: 'radio',
23
+ options: colors
24
+ }
25
+ },
26
+ color: {
27
+ type: 'string',
28
+ control: {
29
+ type: 'radio',
30
+ options: colors
31
+ }
32
+ },
33
+ disabled: {
34
+ type: 'boolean'
35
+ },
36
+ size: {
37
+ type: 'string',
38
+ control: {
39
+ type: 'radio',
40
+ options: ['small', 'medium', 'large', 'extra-large']
41
+ }
42
+ },
43
+ hoverEffect: {
44
+ type: 'radio',
45
+ options: ['hover', 'underline']
46
+ },
47
+ bordered: {
48
+ type: 'boolean'
49
+ },
50
+ fullWidth: {
51
+ type: 'boolean'
52
+ }
53
+ }
54
+ }
55
+
56
+ const Template = (args) => <Button {...args} />
57
+
58
+ export const OnlyLabel = Template.bind({})
59
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
60
+ OnlyLabel.args = {
61
+ label: 'Sample label',
62
+ backgroundColor: 'main-green'
63
+ }
64
+
65
+ export const BorderedRed = Template.bind({})
66
+ BorderedRed.args = {
67
+ label: 'Borderer Red',
68
+ color: 'error-red'
69
+ }
70
+
71
+ export const TransparentWhite = Template.bind({})
72
+ TransparentWhite.args = {
73
+ label: 'White',
74
+ color: 'white',
75
+ icon: faCheck
76
+ }
77
+
78
+ const DisabledTemplate = (args) => {
79
+ const [enabled, setEnabled] = useState(false)
80
+ return (
81
+ <div className='flex flex-col gap-y-6 text-white'>
82
+ <div>
83
+ <Button {...args} disabled={!enabled} onClick={() => alert('clicked')} />
84
+ <span className='ml-4 text-xl'>👈 This button is {enabled ? 'enabled' : 'disabled'}</span>
85
+ </div>
86
+ <div>
87
+ <Button label='Toggle Disabled' backgroundColor='main-green' onClick={() => setEnabled(!enabled)} />
88
+ </div>
89
+ </div>
90
+ )
91
+ }
92
+
93
+ export const DisabledGreen = DisabledTemplate.bind({})
94
+
95
+ DisabledGreen.args = {
96
+ backgroundColor: 'main-green',
97
+ label: 'A simple button',
98
+ color: 'main-dark-blue',
99
+ disabled: true
100
+ }
101
+
102
+ export const DisabledRed = DisabledTemplate.bind({})
103
+ DisabledRed.args = {
104
+ label: 'A simple button',
105
+ color: 'error-red',
106
+ disabled: true
107
+ }
108
+
109
+ export const UsingPlatformaticIcon = Template.bind({})
110
+ UsingPlatformaticIcon.args = {
111
+ label: 'White',
112
+ color: 'white',
113
+ platformaticIcon: { iconName: 'GearIcon', color: 'white' }
114
+ }
@@ -1,61 +1,61 @@
1
- 'use strict'
2
- import { faStop, faRefresh } from '@fortawesome/free-solid-svg-icons'
3
- import ButtonFullRounded from '../components/ButtonFullRounded'
4
-
5
- export default {
6
- title: 'Platformatic/ButtonFullRounded',
7
- component: ButtonFullRounded,
8
- argTypes: {
9
- label: {
10
- type: 'string',
11
- control: 'text'
12
- },
13
- bold: {
14
- type: 'boolean'
15
- },
16
- color: {
17
- type: 'string',
18
- control: {
19
- type: 'radio',
20
- options: ['green', 'red', 'white']
21
- }
22
- },
23
- size: {
24
- type: 'string',
25
- control: {
26
- type: 'radio',
27
- options: ['small', 'medium', 'large']
28
- }
29
- }
30
- }
31
- }
32
-
33
- const Template = (args) => <ButtonFullRounded {...args} />
34
-
35
- export const WhiteLarge = Template.bind({})
36
- WhiteLarge.args = {
37
- icon: faStop,
38
- size: 'large'
39
- }
40
-
41
- export const GreenSmall = Template.bind({})
42
- GreenSmall.args = {
43
- icon: faStop,
44
- color: 'green',
45
- size: 'small'
46
- }
47
-
48
- export const Disabled = Template.bind({})
49
-
50
- Disabled.args = {
51
- icon: faRefresh,
52
- disabled: true
53
- }
54
-
55
- export const DisabledRed = Template.bind({})
56
-
57
- DisabledRed.args = {
58
- icon: faRefresh,
59
- color: 'red',
60
- disabled: true
61
- }
1
+ 'use strict'
2
+ import { faStop, faRefresh } from '@fortawesome/free-solid-svg-icons'
3
+ import ButtonFullRounded from '../components/ButtonFullRounded'
4
+
5
+ export default {
6
+ title: 'Platformatic/ButtonFullRounded',
7
+ component: ButtonFullRounded,
8
+ argTypes: {
9
+ label: {
10
+ type: 'string',
11
+ control: 'text'
12
+ },
13
+ bold: {
14
+ type: 'boolean'
15
+ },
16
+ color: {
17
+ type: 'string',
18
+ control: {
19
+ type: 'radio',
20
+ options: ['green', 'red', 'white']
21
+ }
22
+ },
23
+ size: {
24
+ type: 'string',
25
+ control: {
26
+ type: 'radio',
27
+ options: ['small', 'medium', 'large']
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ const Template = (args) => <ButtonFullRounded {...args} />
34
+
35
+ export const WhiteLarge = Template.bind({})
36
+ WhiteLarge.args = {
37
+ icon: faStop,
38
+ size: 'large'
39
+ }
40
+
41
+ export const GreenSmall = Template.bind({})
42
+ GreenSmall.args = {
43
+ icon: faStop,
44
+ color: 'green',
45
+ size: 'small'
46
+ }
47
+
48
+ export const Disabled = Template.bind({})
49
+
50
+ Disabled.args = {
51
+ icon: faRefresh,
52
+ disabled: true
53
+ }
54
+
55
+ export const DisabledRed = Template.bind({})
56
+
57
+ DisabledRed.args = {
58
+ icon: faRefresh,
59
+ color: 'red',
60
+ disabled: true
61
+ }
@@ -1,27 +1,27 @@
1
- 'use strict'
2
- import Checkbox from '../components/Checkbox'
3
-
4
- export default {
5
- title: 'Platformatic/Checkbox',
6
- component: Checkbox,
7
- argTypes: {
8
- id: {
9
- type: 'string',
10
- control: 'text'
11
- },
12
- disabled: {
13
- type: 'boolean'
14
- }
15
- }
16
- }
17
-
18
- const Template = (args) => <Checkbox {...args} />
19
-
20
- export const CheckboxRegular = Template.bind({})
21
- // More on args: https://storybook.js.org/docs/react/writing-stories/args
22
- CheckboxRegular.args = {}
23
-
24
- export const CheckboxDisabled = Template.bind({})
25
- CheckboxDisabled.args = {
26
- disabled: true
27
- }
1
+ 'use strict'
2
+ import Checkbox from '../components/Checkbox'
3
+
4
+ export default {
5
+ title: 'Platformatic/Checkbox',
6
+ component: Checkbox,
7
+ argTypes: {
8
+ id: {
9
+ type: 'string',
10
+ control: 'text'
11
+ },
12
+ disabled: {
13
+ type: 'boolean'
14
+ }
15
+ }
16
+ }
17
+
18
+ const Template = (args) => <Checkbox {...args} />
19
+
20
+ export const CheckboxRegular = Template.bind({})
21
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
22
+ CheckboxRegular.args = {}
23
+
24
+ export const CheckboxDisabled = Template.bind({})
25
+ CheckboxDisabled.args = {
26
+ disabled: true
27
+ }
@@ -1,33 +1,33 @@
1
- 'use strict'
2
-
3
- import DetailedMetric from '../components/DetailedMetric'
4
-
5
- export default {
6
- title: 'Platformatic/Metrics/DetailedMetric',
7
- component: DetailedMetric
8
- }
9
-
10
- const Template = (args) => <DetailedMetric {...args} />
11
-
12
- export const Default = Template.bind({})
13
-
14
- Default.args = {
15
- title: 'Requests',
16
- color: 'green',
17
- unit: 'ms',
18
- value: 120,
19
- pre: 'P90',
20
- tooltip: 'This is a tooltip for the metric',
21
- leftDetail: {
22
- value: 600,
23
- unit: 'ms',
24
- color: 'green',
25
- pre: 'P99'
26
- },
27
- rightDetail: {
28
- value: 4.42,
29
- unit: 's',
30
- color: 'green',
31
- pre: 'P95'
32
- }
33
- }
1
+ 'use strict'
2
+
3
+ import DetailedMetric from '../components/DetailedMetric'
4
+
5
+ export default {
6
+ title: 'Platformatic/Metrics/DetailedMetric',
7
+ component: DetailedMetric
8
+ }
9
+
10
+ const Template = (args) => <DetailedMetric {...args} />
11
+
12
+ export const Default = Template.bind({})
13
+
14
+ Default.args = {
15
+ title: 'Requests',
16
+ color: 'green',
17
+ unit: 'ms',
18
+ value: 120,
19
+ pre: 'P90',
20
+ tooltip: 'This is a tooltip for the metric',
21
+ leftDetail: {
22
+ value: 600,
23
+ unit: 'ms',
24
+ color: 'green',
25
+ pre: 'P99'
26
+ },
27
+ rightDetail: {
28
+ value: 4.42,
29
+ unit: 's',
30
+ color: 'green',
31
+ pre: 'P95'
32
+ }
33
+ }
@@ -1,62 +1,62 @@
1
- 'use strict'
2
- import DropDown from '../components/DropDown'
3
- import BorderedBox from '../components/BorderedBox'
4
- import HorizontalSeparator from '../components/HorizontalSeparator'
5
- import { useState } from 'react'
6
- export default {
7
- title: 'Platformatic/DropDown',
8
- component: DropDown,
9
- decorators: [dd => <div className='text-white'>{dd()}</div>]
10
- }
11
-
12
- const Template = (args) => (
13
- <div>
14
- <DropDown {...args} />
15
- <HorizontalSeparator />
16
- <ContentThatLoads />
17
- </div>
18
- )
19
-
20
- const ContentThatLoads = () => {
21
- const [content, setContent] = useState(null)
22
- setTimeout(() => {
23
- setContent(<div className='mt-4'><BorderedBox>This is rendered after</BorderedBox></div>)
24
- }, 1000)
25
-
26
- return content
27
- }
28
-
29
- export const DefaultAlignment = Template.bind({})
30
-
31
- DefaultAlignment.args = {
32
- header: 'My Menu',
33
- items: [
34
- <span key='1'>Menu 1</span>,
35
- <span key='2'>Menu 2</span>,
36
- <span key='3'>This is a very long menu item</span>
37
- ]
38
- }
39
-
40
- export const AlignRight = Template.bind({})
41
-
42
- AlignRight.args = {
43
- header: 'My Menu',
44
- align: 'right',
45
- items: [
46
- <span key='1'>Menu 1</span>,
47
- <span key='2'>Menu 2</span>,
48
- <span key='3'>This is a very long menu item</span>
49
- ]
50
- }
51
-
52
- export const AlignLeft = Template.bind({})
53
-
54
- AlignLeft.args = {
55
- header: 'My Menu',
56
- align: 'left',
57
- items: [
58
- <span key='1'>Menu 1</span>,
59
- <span key='2'>Menu 2</span>,
60
- <span key='3'>This is a very long menu item</span>
61
- ]
62
- }
1
+ 'use strict'
2
+ import DropDown from '../components/DropDown'
3
+ import BorderedBox from '../components/BorderedBox'
4
+ import HorizontalSeparator from '../components/HorizontalSeparator'
5
+ import { useState } from 'react'
6
+ export default {
7
+ title: 'Platformatic/DropDown',
8
+ component: DropDown,
9
+ decorators: [dd => <div className='text-white'>{dd()}</div>]
10
+ }
11
+
12
+ const Template = (args) => (
13
+ <div>
14
+ <DropDown {...args} />
15
+ <HorizontalSeparator />
16
+ <ContentThatLoads />
17
+ </div>
18
+ )
19
+
20
+ const ContentThatLoads = () => {
21
+ const [content, setContent] = useState(null)
22
+ setTimeout(() => {
23
+ setContent(<div className='mt-4'><BorderedBox>This is rendered after</BorderedBox></div>)
24
+ }, 1000)
25
+
26
+ return content
27
+ }
28
+
29
+ export const DefaultAlignment = Template.bind({})
30
+
31
+ DefaultAlignment.args = {
32
+ header: 'My Menu',
33
+ items: [
34
+ <span key='1'>Menu 1</span>,
35
+ <span key='2'>Menu 2</span>,
36
+ <span key='3'>This is a very long menu item</span>
37
+ ]
38
+ }
39
+
40
+ export const AlignRight = Template.bind({})
41
+
42
+ AlignRight.args = {
43
+ header: 'My Menu',
44
+ align: 'right',
45
+ items: [
46
+ <span key='1'>Menu 1</span>,
47
+ <span key='2'>Menu 2</span>,
48
+ <span key='3'>This is a very long menu item</span>
49
+ ]
50
+ }
51
+
52
+ export const AlignLeft = Template.bind({})
53
+
54
+ AlignLeft.args = {
55
+ header: 'My Menu',
56
+ align: 'left',
57
+ items: [
58
+ <span key='1'>Menu 1</span>,
59
+ <span key='2'>Menu 2</span>,
60
+ <span key='3'>This is a very long menu item</span>
61
+ ]
62
+ }
@@ -1,14 +1,14 @@
1
- import React from 'react'
2
- import FollowUs from '../components/FollowUs'
3
-
4
- export default {
5
- title: 'Platformatic/FollowUs',
6
- component: FollowUs
7
- }
8
-
9
- const Template = (args) => <FollowUs {...args} />
10
-
11
- export const FollowUsDefault = Template.bind({})
12
- FollowUsDefault.args = {
13
- label: 'Follow us on'
14
- }
1
+ import React from 'react'
2
+ import FollowUs from '../components/FollowUs'
3
+
4
+ export default {
5
+ title: 'Platformatic/FollowUs',
6
+ component: FollowUs
7
+ }
8
+
9
+ const Template = (args) => <FollowUs {...args} />
10
+
11
+ export const FollowUsDefault = Template.bind({})
12
+ FollowUsDefault.args = {
13
+ label: 'Follow us on'
14
+ }
@@ -1,14 +1,14 @@
1
- import React from 'react'
2
- import GHLoginButton from '../components/GHLoginButton'
3
-
4
- export default {
5
- title: 'Platformatic/GHLoginButton',
6
- component: GHLoginButton
7
- }
8
-
9
- const Template = (args) => <GHLoginButton {...args} />
10
-
11
- export const Default = Template.bind({})
12
- Default.args = {
13
- onClick: () => alert('clicked')
14
- }
1
+ import React from 'react'
2
+ import GHLoginButton from '../components/GHLoginButton'
3
+
4
+ export default {
5
+ title: 'Platformatic/GHLoginButton',
6
+ component: GHLoginButton
7
+ }
8
+
9
+ const Template = (args) => <GHLoginButton {...args} />
10
+
11
+ export const Default = Template.bind({})
12
+ Default.args = {
13
+ onClick: () => alert('clicked')
14
+ }