@platformatic/ui-components 0.1.37 → 0.1.39
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.
- package/dist/main.css +5 -5
- package/index.js +6 -3
- package/package.json +1 -1
- package/src/components/Button.jsx +59 -7
- package/src/components/Button.module.css +58 -28
- package/src/components/Common.module.css +20 -2
- package/src/components/HorizontalSeparator.jsx +7 -2
- package/src/components/HorizontalSeparator.module.css +4 -0
- package/src/components/Loadable.jsx +1 -1
- package/src/components/Loader.jsx +22 -0
- package/src/components/Loader.module.css +13 -0
- package/src/components/Logo.jsx +6 -2
- package/src/components/Logo.module.css +6 -0
- package/src/components/Modal.jsx +37 -3
- package/src/components/Modal.module.css +16 -2
- package/src/components/forms/Field.jsx +20 -0
- package/src/components/forms/Field.module.css +18 -0
- package/src/components/forms/Input.jsx +55 -0
- package/src/components/forms/Input.module.css +15 -0
- package/src/components/forms/Preview.jsx +15 -0
- package/src/components/forms/Preview.module.css +12 -0
- package/src/components/forms/ToggleSwitch.jsx +18 -0
- package/src/components/forms/ToggleSwitch.module.css +43 -0
- package/src/components/forms/index.js +8 -0
- package/src/components/icons/Icons.module.css +11 -0
- package/src/components/icons/RoundCloseHoverIcon.jsx +42 -0
- package/src/components/icons/RoundCloseIcon.jsx +32 -0
- package/src/components/icons/index.js +12 -3
- package/src/stories/Button.stories.jsx +25 -45
- package/src/stories/Loader.stories.jsx +44 -0
- package/src/stories/Modal.stories.jsx +7 -1
- package/src/stories/forms/Field.stories.jsx +81 -0
- package/src/stories/forms/Input.stories.jsx +56 -0
- package/src/stories/forms/Preview.stories.jsx +36 -0
- package/src/stories/forms/ToggleSwitch.stories.jsx +15 -0
- package/src/components/Input.jsx +0 -11
- package/src/components/Input.module.css +0 -7
- package/src/components/icons/CloseModalGreenHoverIcon.jsx +0 -37
- package/src/components/icons/CloseModalGreenIcon.jsx +0 -27
- package/src/stories/Input.stories.jsx +0 -15
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
@apply flex w-full h-10 items-center;
|
|
3
|
+
}
|
|
4
|
+
.switch {
|
|
5
|
+
@apply relative inline-block w-[50px] h-[24px];
|
|
6
|
+
}
|
|
7
|
+
.switch input {
|
|
8
|
+
@apply opacity-0 w-0 h-0;
|
|
9
|
+
}
|
|
10
|
+
.slider {
|
|
11
|
+
@apply absolute cursor-pointer top-0 left-0 right-0 bottom-0 h-full;
|
|
12
|
+
background-color: #707070;
|
|
13
|
+
-webkit-transition: .4s;
|
|
14
|
+
transition: .4s;
|
|
15
|
+
}
|
|
16
|
+
.label {
|
|
17
|
+
@apply px-2 text-xs font-normal text-main-dark-blue;
|
|
18
|
+
}
|
|
19
|
+
.slider:before {
|
|
20
|
+
@apply absolute h-4 w-4 left-[4px] bottom-[4px] bg-white;
|
|
21
|
+
content: "";
|
|
22
|
+
-webkit-transition: .4s;
|
|
23
|
+
transition: .4s;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
input:checked + .slider {
|
|
27
|
+
@apply bg-main-green;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
input:checked + .slider:before {
|
|
31
|
+
-webkit-transform: translateX(26px);
|
|
32
|
+
-ms-transform: translateX(26px);
|
|
33
|
+
transform: translateX(26px);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Rounded sliders */
|
|
37
|
+
.slider.round {
|
|
38
|
+
border-radius: 100px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.slider.round:before {
|
|
42
|
+
@apply rounded-full;
|
|
43
|
+
}
|
|
@@ -13,6 +13,17 @@
|
|
|
13
13
|
.white > path {
|
|
14
14
|
@apply stroke-white;
|
|
15
15
|
}
|
|
16
|
+
.main-dark-blue > circle,
|
|
17
|
+
.main-dark-blue > rect,
|
|
18
|
+
.main-dark-blue > path {
|
|
19
|
+
@apply stroke-main-dark-blue;
|
|
20
|
+
}
|
|
21
|
+
.fill-circle-green > circle {
|
|
22
|
+
@apply fill-white;
|
|
23
|
+
}
|
|
24
|
+
.fill-circle-main-dark-blue > circle {
|
|
25
|
+
@apply fill-main-dark-blue;
|
|
26
|
+
}
|
|
16
27
|
|
|
17
28
|
.noShrinkForFlex {
|
|
18
29
|
@apply shrink-0
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import styles from './Icons.module.css'
|
|
3
|
+
|
|
4
|
+
const RoundCloseHoverIcon = ({ color = 'green' }) => {
|
|
5
|
+
const className = styles[`${color}`] + ' ' + styles[`fill-circle-${color}`]
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
width={24}
|
|
9
|
+
height={24}
|
|
10
|
+
viewBox='0 0 24 24'
|
|
11
|
+
fill='none'
|
|
12
|
+
xmlns='http://www.w3.org/2000/svg'
|
|
13
|
+
className={className}
|
|
14
|
+
>
|
|
15
|
+
<circle
|
|
16
|
+
cx={12}
|
|
17
|
+
cy={12}
|
|
18
|
+
r={11.25}
|
|
19
|
+
fill='none'
|
|
20
|
+
fillOpacity={0.2}
|
|
21
|
+
stroke='none'
|
|
22
|
+
strokeWidth={1.5}
|
|
23
|
+
/>
|
|
24
|
+
<path
|
|
25
|
+
d='M6 6L18 18'
|
|
26
|
+
stroke='none'
|
|
27
|
+
strokeWidth={1.5}
|
|
28
|
+
strokeLinecap='round'
|
|
29
|
+
strokeLinejoin='round'
|
|
30
|
+
/>
|
|
31
|
+
<path
|
|
32
|
+
d='M6 18L18 6'
|
|
33
|
+
stroke='none'
|
|
34
|
+
strokeWidth={1.5}
|
|
35
|
+
strokeLinecap='round'
|
|
36
|
+
strokeLinejoin='round'
|
|
37
|
+
/>
|
|
38
|
+
</svg>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default RoundCloseHoverIcon
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import styles from './Icons.module.css'
|
|
3
|
+
|
|
4
|
+
const RoundCloseIcon = ({ color = 'green' }) => {
|
|
5
|
+
const className = styles[`${color}`]
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
width={24}
|
|
9
|
+
height={24}
|
|
10
|
+
viewBox='0 0 24 24'
|
|
11
|
+
fill='none'
|
|
12
|
+
xmlns='http://www.w3.org/2000/svg'
|
|
13
|
+
className={className}
|
|
14
|
+
>
|
|
15
|
+
<circle cx={12} cy={12} r={11.5} stroke='none' />
|
|
16
|
+
<path
|
|
17
|
+
d='M6 6L18 18'
|
|
18
|
+
stroke='none'
|
|
19
|
+
strokeLinecap='round'
|
|
20
|
+
strokeLinejoin='round'
|
|
21
|
+
/>
|
|
22
|
+
<path
|
|
23
|
+
d='M6 18L18 6'
|
|
24
|
+
stroke='none'
|
|
25
|
+
strokeLinecap='round'
|
|
26
|
+
strokeLinejoin='round'
|
|
27
|
+
/>
|
|
28
|
+
</svg>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default RoundCloseIcon
|
|
@@ -2,11 +2,20 @@ import ApiIcon from './ApiIcon'
|
|
|
2
2
|
import ApiIconClosed from './ApiIconClosed'
|
|
3
3
|
import ApiEmptyIcon from './ApiEmptyIcon'
|
|
4
4
|
import CloseModalIcon from './CloseModalIcon'
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import RoundCloseIcon from './RoundCloseIcon'
|
|
6
|
+
import RoundCloseHoverIcon from './RoundCloseHoverIcon'
|
|
7
7
|
import MetricsIcon from './MetricsIcon'
|
|
8
|
+
import PuzzleIcon from './PuzzleIcon'
|
|
8
9
|
import PullRequestIcon from './PullRequestIcon'
|
|
9
10
|
|
|
10
11
|
export default {
|
|
11
|
-
ApiIcon,
|
|
12
|
+
ApiIcon,
|
|
13
|
+
ApiIconClosed,
|
|
14
|
+
ApiEmptyIcon,
|
|
15
|
+
CloseModalIcon,
|
|
16
|
+
RoundCloseIcon,
|
|
17
|
+
RoundCloseHoverIcon,
|
|
18
|
+
MetricsIcon,
|
|
19
|
+
PuzzleIcon,
|
|
20
|
+
PullRequestIcon
|
|
12
21
|
}
|
|
@@ -3,6 +3,8 @@ import { faCheck } from '@fortawesome/free-solid-svg-icons'
|
|
|
3
3
|
import { useState } from 'react'
|
|
4
4
|
import Button from '../components/Button'
|
|
5
5
|
|
|
6
|
+
const colors = ['main-green', 'dark-green', 'light-green', 'main-dark-blue', 'dark-blue', 'light-blue', 'white', 'error-red', 'tertiary-blue', 'transparent']
|
|
7
|
+
|
|
6
8
|
export default {
|
|
7
9
|
title: 'Platformatic/Button',
|
|
8
10
|
component: Button,
|
|
@@ -14,18 +16,18 @@ export default {
|
|
|
14
16
|
bold: {
|
|
15
17
|
type: 'boolean'
|
|
16
18
|
},
|
|
17
|
-
|
|
19
|
+
backgroundColor: {
|
|
18
20
|
type: 'string',
|
|
19
21
|
control: {
|
|
20
22
|
type: 'radio',
|
|
21
|
-
options:
|
|
23
|
+
options: colors
|
|
22
24
|
}
|
|
23
25
|
},
|
|
24
26
|
color: {
|
|
25
27
|
type: 'string',
|
|
26
28
|
control: {
|
|
27
29
|
type: 'radio',
|
|
28
|
-
options:
|
|
30
|
+
options: colors
|
|
29
31
|
}
|
|
30
32
|
},
|
|
31
33
|
disabled: {
|
|
@@ -37,57 +39,38 @@ export default {
|
|
|
37
39
|
type: 'radio',
|
|
38
40
|
options: ['small', 'medium', 'large', 'extra-large']
|
|
39
41
|
}
|
|
42
|
+
},
|
|
43
|
+
underlineEffect: {
|
|
44
|
+
type: 'boolean'
|
|
45
|
+
},
|
|
46
|
+
bordered: {
|
|
47
|
+
type: 'boolean'
|
|
40
48
|
}
|
|
41
49
|
}
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
const Template = (args) => <Button {...args} />
|
|
45
53
|
|
|
46
|
-
export const
|
|
54
|
+
export const OnlyLabel = Template.bind({})
|
|
47
55
|
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
color: 'green',
|
|
52
|
-
bold: true
|
|
56
|
+
OnlyLabel.args = {
|
|
57
|
+
label: 'Sample label',
|
|
58
|
+
backgroundColor: 'light-green'
|
|
53
59
|
}
|
|
54
60
|
|
|
55
|
-
export const
|
|
56
|
-
|
|
57
|
-
label: '
|
|
58
|
-
color: 'red'
|
|
61
|
+
export const BorderedRed = Template.bind({})
|
|
62
|
+
BorderedRed.args = {
|
|
63
|
+
label: 'Borderer Red',
|
|
64
|
+
color: 'error-red'
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
export const TransparentWhite = Template.bind({})
|
|
62
68
|
TransparentWhite.args = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
color: 'white'
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export const PrimaryWithIcon = Template.bind({})
|
|
69
|
-
PrimaryWithIcon.args = {
|
|
70
|
-
buttonClass: 'primary',
|
|
71
|
-
label: 'Primary with Icon',
|
|
69
|
+
label: 'White',
|
|
70
|
+
color: 'white',
|
|
72
71
|
icon: faCheck
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
export const SecondaryWithIcon = Template.bind({})
|
|
76
|
-
SecondaryWithIcon.args = {
|
|
77
|
-
buttonClass: 'secondary',
|
|
78
|
-
label: 'Secondary with Icon',
|
|
79
|
-
icon: faCheck,
|
|
80
|
-
color: 'white'
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export const PrimaryRed = Template.bind({})
|
|
84
|
-
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
85
|
-
PrimaryRed.args = {
|
|
86
|
-
buttonClass: 'primary',
|
|
87
|
-
label: 'Primary Red',
|
|
88
|
-
color: 'red'
|
|
89
|
-
}
|
|
90
|
-
|
|
91
74
|
const DisabledTemplate = (args) => {
|
|
92
75
|
const [enabled, setEnabled] = useState(false)
|
|
93
76
|
return (
|
|
@@ -97,28 +80,25 @@ const DisabledTemplate = (args) => {
|
|
|
97
80
|
<span className='ml-4 text-xl'>👈 This button is {enabled ? 'enabled' : 'disabled'}</span>
|
|
98
81
|
</div>
|
|
99
82
|
<div>
|
|
100
|
-
<Button label='Toggle Disabled'
|
|
83
|
+
<Button label='Toggle Disabled' backgroundColor='main-green' onClick={() => setEnabled(!enabled)} />
|
|
101
84
|
</div>
|
|
102
|
-
|
|
103
85
|
</div>
|
|
104
|
-
|
|
105
86
|
)
|
|
106
87
|
}
|
|
107
88
|
|
|
108
89
|
export const DisabledGreen = DisabledTemplate.bind({})
|
|
109
90
|
|
|
110
91
|
DisabledGreen.args = {
|
|
111
|
-
|
|
92
|
+
backgroundColor: 'main-green',
|
|
112
93
|
label: 'A simple button',
|
|
113
|
-
color: '
|
|
94
|
+
color: 'main-dark-blue',
|
|
114
95
|
disabled: true
|
|
115
96
|
}
|
|
116
97
|
|
|
117
98
|
export const DisabledRed = DisabledTemplate.bind({})
|
|
118
99
|
|
|
119
100
|
DisabledRed.args = {
|
|
120
|
-
buttonClass: 'primary',
|
|
121
101
|
label: 'A simple button',
|
|
122
|
-
color: 'red',
|
|
102
|
+
color: 'error-red',
|
|
123
103
|
disabled: true
|
|
124
104
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import Loader from '../components/Loader'
|
|
3
|
+
import Button from '../components/Button'
|
|
4
|
+
import BorderedBox from '../components/BorderedBox'
|
|
5
|
+
|
|
6
|
+
const loremIpsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus est nisl, maximus aliquet urna eu, consequat semper nisi. Nam vel elit feugiat dui congue elementum. Sed turpis urna, egestas at pharetra et, lacinia ac mauris. Pellentesque cursus, ipsum nec malesuada ornare, dui purus ultrices elit, non blandit nisi quam non nisi. Suspendisse sapien leo, ultricies pretium vulputate sed, malesuada sed justo. Suspendisse euismod erat ut lacus feugiat malesuada. In tempor a eros et egestas. Nam pretium dolor sollicitudin, cursus sem vitae, elementum enim. Nam in nisi ipsum.'
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Platformatic/Loader',
|
|
10
|
+
component: Loader
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Loading = args =>
|
|
14
|
+
<Loader {...args}>
|
|
15
|
+
<BorderedBox>{loremIpsum}</BorderedBox>
|
|
16
|
+
</Loader>
|
|
17
|
+
|
|
18
|
+
Loading.args = {
|
|
19
|
+
loading: true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const LoadsAndStops = ({ loading, ...args }) => {
|
|
23
|
+
const [showLoader, setShowLoader] = useState(args.loading)
|
|
24
|
+
const show = () => setShowLoader(true)
|
|
25
|
+
const hide = () => setShowLoader(false)
|
|
26
|
+
|
|
27
|
+
function load () {
|
|
28
|
+
show()
|
|
29
|
+
const timer = setTimeout(() => {
|
|
30
|
+
hide()
|
|
31
|
+
}, 2000)
|
|
32
|
+
return () => clearTimeout(timer)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Loader loading={showLoader} {...args}>
|
|
37
|
+
<Button label='Start Loading' color='error-red' onClick={() => load()} />
|
|
38
|
+
<BorderedBox>{loremIpsum}</BorderedBox>
|
|
39
|
+
</Loader>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
LoadsAndStops.args = {
|
|
43
|
+
loading: false
|
|
44
|
+
}
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
type: 'string',
|
|
13
13
|
control: {
|
|
14
14
|
type: 'radio',
|
|
15
|
-
options: ['info', 'invite']
|
|
15
|
+
options: ['info', 'invite', 'fullscreen']
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -92,3 +92,9 @@ InviteLayout.args = {
|
|
|
92
92
|
title: 'Give me an invite',
|
|
93
93
|
layout: 'invite'
|
|
94
94
|
}
|
|
95
|
+
|
|
96
|
+
export const FullscreenLayout = Template.bind({})
|
|
97
|
+
FullscreenLayout.args = {
|
|
98
|
+
title: 'Give me an invite',
|
|
99
|
+
layout: 'fullscreen'
|
|
100
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
import Field from '../../components/forms/Field'
|
|
3
|
+
import Button from '../../components/Button'
|
|
4
|
+
import Input from '../../components/forms/Input'
|
|
5
|
+
|
|
6
|
+
const divStyle = {
|
|
7
|
+
width: '100%',
|
|
8
|
+
height: 'auto',
|
|
9
|
+
padding: '10px',
|
|
10
|
+
backgroundColor: 'white'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: 'Platformatic/Forms/Field',
|
|
15
|
+
component: Field,
|
|
16
|
+
parameters: {
|
|
17
|
+
backgrounds: {
|
|
18
|
+
default: 'white'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const SimpleTemplate = (args) => <div style={divStyle}><Field {...args} /></div>
|
|
24
|
+
|
|
25
|
+
export const BasicField = SimpleTemplate.bind({})
|
|
26
|
+
|
|
27
|
+
BasicField.args = {
|
|
28
|
+
title: 'Field basic',
|
|
29
|
+
helper: 'A very very very very very very very very very very very very very very simple helper'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const InputTemplate = (args) => {
|
|
33
|
+
function renderChild (combinationSelected) {
|
|
34
|
+
let rendered = <></>
|
|
35
|
+
|
|
36
|
+
switch (combinationSelected) {
|
|
37
|
+
case 'button':
|
|
38
|
+
rendered = (<Button label='Button for a purpose' color='error-red' onClick={() => { alert('clicked') }} />)
|
|
39
|
+
break
|
|
40
|
+
case 'input-buttons':
|
|
41
|
+
rendered =
|
|
42
|
+
(
|
|
43
|
+
<>
|
|
44
|
+
<Input name='test' placeholder='Platformatic' errorMessage='this is an error message' />
|
|
45
|
+
<Button label='Button for some purposes' color='main-dark-blue' onClick={() => { alert('clicked') }} />
|
|
46
|
+
<Button label='Button for other purposes' color='error-red' onClick={() => { alert('clicked') }} />
|
|
47
|
+
</>
|
|
48
|
+
)
|
|
49
|
+
break
|
|
50
|
+
case 'input':
|
|
51
|
+
rendered = (<Input name='test' placeholder='Platformatic' />)
|
|
52
|
+
break
|
|
53
|
+
case 'input-button':
|
|
54
|
+
rendered =
|
|
55
|
+
(
|
|
56
|
+
<>
|
|
57
|
+
<Input name='test' placeholder='Platformatic' />
|
|
58
|
+
<Button label='Button Simple' color='main-dark-blue' onClick={() => { alert('clicked') }} />
|
|
59
|
+
</>
|
|
60
|
+
)
|
|
61
|
+
break
|
|
62
|
+
default:
|
|
63
|
+
break
|
|
64
|
+
}
|
|
65
|
+
return rendered
|
|
66
|
+
}
|
|
67
|
+
return (
|
|
68
|
+
<div style={divStyle}>
|
|
69
|
+
{['input', 'input-button', 'input-buttons', 'button'].map(how => {
|
|
70
|
+
return (<Field key={how} {...args}>{renderChild(how)}</Field>)
|
|
71
|
+
})}
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const WithInput = InputTemplate.bind({})
|
|
77
|
+
|
|
78
|
+
WithInput.args = {
|
|
79
|
+
title: 'Different cases',
|
|
80
|
+
helper: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
|
|
81
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
|
+
import Input from '../../components/forms/Input'
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Platformatic/Forms/Input',
|
|
6
|
+
component: Input
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args) => <Input {...args} />
|
|
10
|
+
|
|
11
|
+
export const Default = Template.bind({})
|
|
12
|
+
|
|
13
|
+
Default.args = {
|
|
14
|
+
name: 'test',
|
|
15
|
+
placeholder: 'Platformatic'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const TemplateBorderMainDarkBlue = (args) => <div style={{ backgroundColor: 'white', padding: '2px' }}><Input {...args} /></div>
|
|
19
|
+
|
|
20
|
+
export const BorderMainDarkBlue = TemplateBorderMainDarkBlue.bind({})
|
|
21
|
+
|
|
22
|
+
BorderMainDarkBlue.args = {
|
|
23
|
+
name: 'test',
|
|
24
|
+
placeholder: 'Platformatic',
|
|
25
|
+
borderColor: 'main-dark-blue'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const DefaultInvalid = Template.bind({})
|
|
29
|
+
|
|
30
|
+
DefaultInvalid.args = {
|
|
31
|
+
name: 'test',
|
|
32
|
+
placeholder: 'Platformatic',
|
|
33
|
+
errorMessage: 'This is an error message'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const TemplateValuedAndAlertChange = (args) => {
|
|
37
|
+
const [value, setValue] = useState('Initial value')
|
|
38
|
+
|
|
39
|
+
function handleChange (event) {
|
|
40
|
+
setValue(event.target.value)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<p>Value of the input {value}</p>
|
|
46
|
+
<Input {...args} value={value} onChange={handleChange} />
|
|
47
|
+
</>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const ValuedAndAlertChange = TemplateValuedAndAlertChange.bind({})
|
|
52
|
+
|
|
53
|
+
ValuedAndAlertChange.args = {
|
|
54
|
+
name: 'test',
|
|
55
|
+
placeholder: 'Platformatic'
|
|
56
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
import Preview from '../../components/forms/Preview'
|
|
3
|
+
|
|
4
|
+
const divStyle = {
|
|
5
|
+
width: '100%',
|
|
6
|
+
height: 'auto',
|
|
7
|
+
padding: '10px',
|
|
8
|
+
backgroundColor: 'white'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: 'Platformatic/Forms/Preview',
|
|
13
|
+
component: Preview,
|
|
14
|
+
parameters: {
|
|
15
|
+
backgrounds: {
|
|
16
|
+
default: 'white'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const SimpleTemplate = (args) => <div style={divStyle}><Preview {...args} /></div>
|
|
22
|
+
|
|
23
|
+
export const NormalPreview = SimpleTemplate.bind({})
|
|
24
|
+
|
|
25
|
+
NormalPreview.args = {
|
|
26
|
+
title: 'My title',
|
|
27
|
+
value: 'My value'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const WithLink = SimpleTemplate.bind({})
|
|
31
|
+
|
|
32
|
+
WithLink.args = {
|
|
33
|
+
title: 'My value is a link',
|
|
34
|
+
value: 'https://example.com',
|
|
35
|
+
isLink: true
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
import ToggleSwitch from '../../components/forms/ToggleSwitch'
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Platformatic/Forms/ToggleSwitch',
|
|
5
|
+
component: ToggleSwitch
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const Template = (args) => <ToggleSwitch {...args} />
|
|
9
|
+
|
|
10
|
+
export const Default = Template.bind({})
|
|
11
|
+
|
|
12
|
+
Default.args = {
|
|
13
|
+
name: 'test',
|
|
14
|
+
label: 'This is a label'
|
|
15
|
+
}
|
package/src/components/Input.jsx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import styles from './Input.module.css'
|
|
4
|
-
import commonStyles from './Common.module.css'
|
|
5
|
-
export default function Input ({ placeholder, value, name }) {
|
|
6
|
-
return (
|
|
7
|
-
<div className={`${styles.inputContainer} ${commonStyles.padded}`}>
|
|
8
|
-
<input type='text' name={name} value={value} placeholder={placeholder} className='grow' />
|
|
9
|
-
</div>
|
|
10
|
-
)
|
|
11
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
|
|
3
|
-
const CloseModalGreenHoverIcon = () => (
|
|
4
|
-
<svg
|
|
5
|
-
width={24}
|
|
6
|
-
height={24}
|
|
7
|
-
viewBox='0 0 24 24'
|
|
8
|
-
fill='none'
|
|
9
|
-
xmlns='http://www.w3.org/2000/svg'
|
|
10
|
-
>
|
|
11
|
-
<circle
|
|
12
|
-
cx={12}
|
|
13
|
-
cy={12}
|
|
14
|
-
r={11.25}
|
|
15
|
-
fill='#21FA90'
|
|
16
|
-
fillOpacity={0.2}
|
|
17
|
-
stroke='#21FA90'
|
|
18
|
-
strokeWidth={1.5}
|
|
19
|
-
/>
|
|
20
|
-
<path
|
|
21
|
-
d='M6 6L18 18'
|
|
22
|
-
stroke='#21FA90'
|
|
23
|
-
strokeWidth={1.5}
|
|
24
|
-
strokeLinecap='round'
|
|
25
|
-
strokeLinejoin='round'
|
|
26
|
-
/>
|
|
27
|
-
<path
|
|
28
|
-
d='M6 18L18 6'
|
|
29
|
-
stroke='#21FA90'
|
|
30
|
-
strokeWidth={1.5}
|
|
31
|
-
strokeLinecap='round'
|
|
32
|
-
strokeLinejoin='round'
|
|
33
|
-
/>
|
|
34
|
-
</svg>
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
export default CloseModalGreenHoverIcon
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
|
|
3
|
-
const CloseModalGreenIcon = () => (
|
|
4
|
-
<svg
|
|
5
|
-
width={24}
|
|
6
|
-
height={24}
|
|
7
|
-
viewBox='0 0 24 24'
|
|
8
|
-
fill='none'
|
|
9
|
-
xmlns='http://www.w3.org/2000/svg'
|
|
10
|
-
>
|
|
11
|
-
<circle cx={12} cy={12} r={11.5} stroke='#21FA90' />
|
|
12
|
-
<path
|
|
13
|
-
d='M6 6L18 18'
|
|
14
|
-
stroke='#21FA90'
|
|
15
|
-
strokeLinecap='round'
|
|
16
|
-
strokeLinejoin='round'
|
|
17
|
-
/>
|
|
18
|
-
<path
|
|
19
|
-
d='M6 18L18 6'
|
|
20
|
-
stroke='#21FA90'
|
|
21
|
-
strokeLinecap='round'
|
|
22
|
-
strokeLinejoin='round'
|
|
23
|
-
/>
|
|
24
|
-
</svg>
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
export default CloseModalGreenIcon
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import Input from '../components/Input'
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Platformatic/Input',
|
|
5
|
-
component: Input
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const Template = (args) => <Input {...args} />
|
|
9
|
-
|
|
10
|
-
export const Default = Template.bind({})
|
|
11
|
-
|
|
12
|
-
Default.args = {
|
|
13
|
-
name: 'test',
|
|
14
|
-
placeholder: 'Platformatic'
|
|
15
|
-
}
|