@platformatic/ui-components 0.1.47 → 0.1.49
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/package.json +1 -1
- package/src/components/Button.jsx +14 -3
- package/src/components/Button.module.css +1 -1
- package/src/components/MetricValue.module.css +1 -1
- package/src/components/Modal.jsx +2 -6
- package/src/components/Modal.module.css +0 -9
- package/src/components/forms/Input.jsx +20 -27
- package/src/components/forms/Input.module.css +1 -1
- package/src/components/icons/AppIcon.jsx +1 -1
- package/src/components/icons/Calendar1Icon.jsx +54 -0
- package/src/components/icons/Calendar7Icon.jsx +55 -0
- package/src/components/icons/CalendarIcon.jsx +56 -0
- package/src/components/icons/CopyIcon.jsx +29 -0
- package/src/components/icons/EditIcon.jsx +38 -0
- package/src/components/icons/LiveIcon.jsx +43 -0
- package/src/components/icons/PlayIcon.jsx +20 -0
- package/src/components/icons/StopIcon.jsx +21 -0
- package/src/components/icons/TerminalIcon.jsx +22 -0
- package/src/components/icons/index.js +20 -4
- package/src/stories/Button.stories.jsx +7 -1
- package/src/stories/PlatformaticIcon.stories.jsx +21 -0
- package/src/stories/forms/Input.stories.jsx +25 -5
package/package.json
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import styles from './Button.module.css'
|
|
5
|
+
import PlatformaticIcon from './PlatformaticIcon'
|
|
5
6
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
6
7
|
|
|
7
8
|
function Button (props) {
|
|
8
|
-
const { icon, label, color, backgroundColor, size, disabled, bold, hoverEffect, bordered, fullWidth, ...rest } = props
|
|
9
|
+
const { icon, label, color, backgroundColor, size, disabled, bold, hoverEffect, bordered, fullWidth, platformaticIcon, ...rest } = props
|
|
9
10
|
let className = `${styles.button} ${styles['background-color-' + backgroundColor]} ${styles['color-' + color]} ${styles['button-' + size]}`
|
|
10
11
|
if (!bordered) className += ` ${styles['no-border']}`
|
|
11
12
|
if (disabled) {
|
|
@@ -22,6 +23,7 @@ function Button (props) {
|
|
|
22
23
|
return (
|
|
23
24
|
<button className={className} disabled={disabled} alt={label} {...rest}>
|
|
24
25
|
{icon ? <FontAwesomeIcon icon={icon} className={`${styles['margin-right-' + size]}`} data-testid='button-icon' /> : null}
|
|
26
|
+
{platformaticIcon ? <PlatformaticIcon iconName={platformaticIcon.iconName} color={platformaticIcon.color} data-testid='button-icon' onClick={null} /> : null}
|
|
25
27
|
<span>{label}</span>
|
|
26
28
|
</button>
|
|
27
29
|
)
|
|
@@ -67,10 +69,18 @@ Button.propTypes = {
|
|
|
67
69
|
/**
|
|
68
70
|
* Full Width: default false
|
|
69
71
|
*/
|
|
70
|
-
fullWidth: PropTypes.bool
|
|
72
|
+
fullWidth: PropTypes.bool,
|
|
73
|
+
/**
|
|
74
|
+
* platformaticIcon: should be removed once we use totally our icons
|
|
75
|
+
*/
|
|
76
|
+
platformaticIcon: PropTypes.shape({
|
|
77
|
+
iconName: PropTypes.string,
|
|
78
|
+
color: PropTypes.string
|
|
79
|
+
})
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
Button.defaultProps = {
|
|
83
|
+
label: '',
|
|
74
84
|
color: 'main-dark-blue',
|
|
75
85
|
backgroundColor: 'transparent',
|
|
76
86
|
disabled: false,
|
|
@@ -78,7 +88,8 @@ Button.defaultProps = {
|
|
|
78
88
|
bold: false,
|
|
79
89
|
hoverEffect: 'hover',
|
|
80
90
|
bordered: true,
|
|
81
|
-
fullWidth: false
|
|
91
|
+
fullWidth: false,
|
|
92
|
+
platformaticIcon: null
|
|
82
93
|
}
|
|
83
94
|
|
|
84
95
|
export default Button
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.button {
|
|
2
|
-
@apply rounded text-center cursor-pointer font-normal rounded-md border border-solid box-border;
|
|
2
|
+
@apply rounded text-center cursor-pointer font-normal rounded-md border border-solid box-border flex items-center justify-center gap-x-2;
|
|
3
3
|
}
|
|
4
4
|
.fontBold {
|
|
5
5
|
@apply font-semibold;
|
package/src/components/Modal.jsx
CHANGED
|
@@ -4,15 +4,12 @@ import CloseIcon from './icons/CloseIcon'
|
|
|
4
4
|
import CircleCloseIcon from './icons/CircleCloseIcon'
|
|
5
5
|
import CircleCloseHoverIcon from './icons/CircleCloseHoverIcon'
|
|
6
6
|
import Logo from './Logo'
|
|
7
|
-
import HorizontalSeparator from './HorizontalSeparator'
|
|
8
7
|
import styles from './Modal.module.css'
|
|
9
8
|
|
|
10
9
|
export default function Modal (props) {
|
|
11
|
-
const { setIsOpen, title, layout = 'info'
|
|
10
|
+
const { setIsOpen, title, layout = 'info' } = props
|
|
12
11
|
const [isHoverCloseModal, setIsHoverCloseModal] = useState(false)
|
|
13
12
|
useEscapeKey(() => setIsOpen(false))
|
|
14
|
-
const styledMaxWidth = styles[`maxW${maxWidth}`]
|
|
15
|
-
const classNameFullScreen = `${styles.contentFullscreen} ${styledMaxWidth}`
|
|
16
13
|
let whichModal = <></>
|
|
17
14
|
|
|
18
15
|
switch (layout) {
|
|
@@ -76,12 +73,11 @@ export default function Modal (props) {
|
|
|
76
73
|
{isHoverCloseModal ? <CircleCloseHoverIcon color='main-dark-blue' /> : <CircleCloseIcon color='main-dark-blue' />}
|
|
77
74
|
</div>
|
|
78
75
|
</div>
|
|
79
|
-
<div className={
|
|
76
|
+
<div className={styles.contentFullscreen}>
|
|
80
77
|
<div className={styles.titleFullscreen}>
|
|
81
78
|
<Logo width={100} heigth={80} color='main-dark-blue' />
|
|
82
79
|
<h3>PLATFORMATIC</h3>
|
|
83
80
|
</div>
|
|
84
|
-
<HorizontalSeparator marginTop={10} marginBottom={10} color='main-dark-blue' opacity={20} />
|
|
85
81
|
<div>{props.children}</div>
|
|
86
82
|
</div>
|
|
87
83
|
</div>
|
|
@@ -41,15 +41,6 @@
|
|
|
41
41
|
.contentFullscreen {
|
|
42
42
|
@apply h-auto w-full pt-4;
|
|
43
43
|
}
|
|
44
|
-
.maxW50 {
|
|
45
|
-
@apply max-w-[50%];
|
|
46
|
-
}
|
|
47
|
-
.maxW70 {
|
|
48
|
-
@apply max-w-[70%];
|
|
49
|
-
}
|
|
50
|
-
.maxW100 {
|
|
51
|
-
@apply max-w-[100%];
|
|
52
|
-
}
|
|
53
44
|
.titleFullscreen {
|
|
54
45
|
@apply inline-flex items-center;
|
|
55
46
|
}
|
|
@@ -3,19 +3,19 @@ import React from 'react'
|
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import styles from './Input.module.css'
|
|
5
5
|
import commonStyles from '../Common.module.css'
|
|
6
|
-
import
|
|
6
|
+
import PlatformaticIcon from '../PlatformaticIcon'
|
|
7
7
|
|
|
8
|
-
function Input ({ placeholder, value, name, borderColor, errorMessage, onChange, disabled,
|
|
8
|
+
function Input ({ placeholder, value, name, borderColor, errorMessage, onChange, disabled, beforeIcon, afterIcon }) {
|
|
9
9
|
let className = styles.inputContainer + ' ' + commonStyles[`bordered--${borderColor}`] + ' ' + commonStyles[`text--${borderColor}`] + ' ' + commonStyles.padded
|
|
10
10
|
const showError = errorMessage.length > 0
|
|
11
11
|
if (showError) className += ' ' + commonStyles['bordered--error-red']
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
return (
|
|
14
14
|
<div className={styles.container}>
|
|
15
15
|
<div className={className}>
|
|
16
|
-
{
|
|
16
|
+
{beforeIcon && <PlatformaticIcon iconName={beforeIcon.iconName} classes={styles.beforeInputIcon} size='small' data-testid='before-icon' color={beforeIcon.color} onClick={() => beforeIcon.onClick()} />}
|
|
17
17
|
<input type='text' name={name} value={value} placeholder={placeholder} className={styles.fullWidth} onChange={onChange} disabled={disabled} />
|
|
18
|
-
{
|
|
18
|
+
{afterIcon && <PlatformaticIcon iconName={afterIcon.iconName} color={afterIcon.color} data-testid='after-icon' onClick={null} />}
|
|
19
19
|
</div>
|
|
20
20
|
{showError && <span className={commonStyles['error-message']}>{errorMessage}</span>}
|
|
21
21
|
</div>
|
|
@@ -48,40 +48,33 @@ Input.propTypes = {
|
|
|
48
48
|
*/
|
|
49
49
|
disabled: PropTypes.bool,
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
beforeInputIcon: PropTypes.object,
|
|
54
|
-
/**
|
|
55
|
-
* beforeInputIconColor
|
|
56
|
-
*/
|
|
57
|
-
beforeInputIconColor: PropTypes.oneOf(['error-red', 'main-dark-blue', 'white']),
|
|
58
|
-
/**
|
|
59
|
-
* afterInputIcon
|
|
60
|
-
*/
|
|
61
|
-
afterInputIcon: PropTypes.object,
|
|
62
|
-
/**
|
|
63
|
-
* afterInputIconColor
|
|
51
|
+
* beforeIcon: PlatformaticIcon props
|
|
64
52
|
*/
|
|
65
|
-
|
|
53
|
+
beforeIcon: PropTypes.shape({
|
|
54
|
+
iconName: PropTypes.string,
|
|
55
|
+
color: PropTypes.string,
|
|
56
|
+
onClick: PropTypes.func
|
|
57
|
+
}),
|
|
66
58
|
/**
|
|
67
|
-
*
|
|
59
|
+
* afterIcon: PlatformaticIcon props
|
|
68
60
|
*/
|
|
69
|
-
|
|
61
|
+
afterIcon: PropTypes.shape({
|
|
62
|
+
iconName: PropTypes.string,
|
|
63
|
+
color: PropTypes.string,
|
|
64
|
+
onClick: PropTypes.func
|
|
65
|
+
})
|
|
70
66
|
}
|
|
71
67
|
|
|
72
68
|
Input.defaultProps = {
|
|
73
69
|
placeholder: '',
|
|
74
|
-
value:
|
|
70
|
+
value: '',
|
|
75
71
|
name: '',
|
|
76
72
|
borderColor: 'main-green',
|
|
77
73
|
errorMessage: '',
|
|
78
74
|
onChange: () => {},
|
|
79
75
|
disabled: false,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
afterInputIcon: null,
|
|
83
|
-
onClickBeforeIcon: () => {},
|
|
84
|
-
afterInputIconColor: 'main-dark-blue'
|
|
76
|
+
beforeIcon: null,
|
|
77
|
+
afterIcon: null
|
|
85
78
|
}
|
|
86
79
|
|
|
87
80
|
export default Input
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import styles from './Icons.module.css'
|
|
3
|
+
|
|
4
|
+
const Calendar1Icon = ({ color = 'green', size = 'normal' }) => {
|
|
5
|
+
const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
|
|
6
|
+
let icon = <></>
|
|
7
|
+
switch (size) {
|
|
8
|
+
case 'small':
|
|
9
|
+
icon = (
|
|
10
|
+
<svg
|
|
11
|
+
width={16}
|
|
12
|
+
height={16}
|
|
13
|
+
viewBox='0 0 16 16'
|
|
14
|
+
fill='none'
|
|
15
|
+
xmlns='http://www.w3.org/2000/svg'
|
|
16
|
+
className={className}
|
|
17
|
+
>
|
|
18
|
+
<rect x={2} y={4} width={12} height={10} rx={1} stroke='none' />
|
|
19
|
+
<path
|
|
20
|
+
d='M2 7H5M14 7H11'
|
|
21
|
+
stroke='none'
|
|
22
|
+
strokeLinecap='round'
|
|
23
|
+
strokeLinejoin='round'
|
|
24
|
+
/>
|
|
25
|
+
<line
|
|
26
|
+
x1={4.5}
|
|
27
|
+
y1={5.5}
|
|
28
|
+
x2={4.5}
|
|
29
|
+
y2={2.5}
|
|
30
|
+
stroke='none'
|
|
31
|
+
strokeLinecap='round'
|
|
32
|
+
/>
|
|
33
|
+
<line
|
|
34
|
+
x1={11.5}
|
|
35
|
+
y1={5.5}
|
|
36
|
+
x2={11.5}
|
|
37
|
+
y2={2.5}
|
|
38
|
+
stroke='none'
|
|
39
|
+
strokeLinecap='round'
|
|
40
|
+
/>
|
|
41
|
+
<path
|
|
42
|
+
d='M7.59712 13V6.5L8.21223 7.09L7.59712 8H7.5L6.5 9V7L7.5 6H9V13H7.59712Z'
|
|
43
|
+
fill='none'
|
|
44
|
+
/>
|
|
45
|
+
</svg>
|
|
46
|
+
)
|
|
47
|
+
break
|
|
48
|
+
default:
|
|
49
|
+
break
|
|
50
|
+
}
|
|
51
|
+
return icon
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default Calendar1Icon
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import styles from './Icons.module.css'
|
|
3
|
+
|
|
4
|
+
const Calendar7Icon = ({ color = 'green', size = 'normal' }) => {
|
|
5
|
+
const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
|
|
6
|
+
let icon = <></>
|
|
7
|
+
switch (size) {
|
|
8
|
+
case 'small':
|
|
9
|
+
icon = (
|
|
10
|
+
<svg
|
|
11
|
+
width={16}
|
|
12
|
+
height={16}
|
|
13
|
+
viewBox='0 0 16 16'
|
|
14
|
+
fill='none'
|
|
15
|
+
xmlns='http://www.w3.org/2000/svg'
|
|
16
|
+
className={className}
|
|
17
|
+
>
|
|
18
|
+
<rect x={2} y={4} width={12} height={10} rx={1} stroke='none' />
|
|
19
|
+
|
|
20
|
+
<path
|
|
21
|
+
d='M2 7H4M14 7H12'
|
|
22
|
+
stroke='none'
|
|
23
|
+
strokeLinecap='round'
|
|
24
|
+
strokeLinejoin='round'
|
|
25
|
+
/>
|
|
26
|
+
<line
|
|
27
|
+
x1={4.5}
|
|
28
|
+
y1={5.5}
|
|
29
|
+
x2={4.5}
|
|
30
|
+
y2={2.5}
|
|
31
|
+
stroke='none'
|
|
32
|
+
strokeLinecap='round'
|
|
33
|
+
/>
|
|
34
|
+
<line
|
|
35
|
+
x1={11.5}
|
|
36
|
+
y1={5.5}
|
|
37
|
+
x2={11.5}
|
|
38
|
+
y2={2.5}
|
|
39
|
+
stroke='none'
|
|
40
|
+
strokeLinecap='round'
|
|
41
|
+
/>
|
|
42
|
+
<path
|
|
43
|
+
d='M6.46691 13L9.65441 6.52L10.0294 7.1H5.65074L6.33456 6.47V8.29H5V6H11V6.87L8 13H6.46691Z'
|
|
44
|
+
fill='none'
|
|
45
|
+
/>
|
|
46
|
+
</svg>
|
|
47
|
+
)
|
|
48
|
+
break
|
|
49
|
+
default:
|
|
50
|
+
break
|
|
51
|
+
}
|
|
52
|
+
return icon
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default Calendar7Icon
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import styles from './Icons.module.css'
|
|
3
|
+
|
|
4
|
+
const CalendarIcon = ({ color = 'green', size = 'normal' }) => {
|
|
5
|
+
const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
|
|
6
|
+
let icon = <></>
|
|
7
|
+
switch (size) {
|
|
8
|
+
case 'small':
|
|
9
|
+
icon = (
|
|
10
|
+
<svg
|
|
11
|
+
width={16}
|
|
12
|
+
height={16}
|
|
13
|
+
viewBox='0 0 16 16'
|
|
14
|
+
fill='none'
|
|
15
|
+
xmlns='http://www.w3.org/2000/svg'
|
|
16
|
+
className={className}
|
|
17
|
+
>
|
|
18
|
+
<rect x={2} y={4} width={12} height={10} rx={1} stroke='none' />
|
|
19
|
+
<path
|
|
20
|
+
d='M2 7H14'
|
|
21
|
+
stroke='none'
|
|
22
|
+
strokeLinecap='round'
|
|
23
|
+
strokeLinejoin='round'
|
|
24
|
+
/>
|
|
25
|
+
<line
|
|
26
|
+
x1={4.5}
|
|
27
|
+
y1={5.5}
|
|
28
|
+
x2={4.5}
|
|
29
|
+
y2={2.5}
|
|
30
|
+
stroke='none'
|
|
31
|
+
strokeLinecap='round'
|
|
32
|
+
/>
|
|
33
|
+
<line
|
|
34
|
+
x1={11.5}
|
|
35
|
+
y1={5.5}
|
|
36
|
+
x2={11.5}
|
|
37
|
+
y2={2.5}
|
|
38
|
+
stroke='none'
|
|
39
|
+
strokeLinecap='round'
|
|
40
|
+
/>
|
|
41
|
+
<rect x={4} y={8} width={2} height={2} rx={0.5} fill='none' />
|
|
42
|
+
<rect x={4} y={11} width={2} height={2} rx={0.5} fill='none' />
|
|
43
|
+
<rect x={7} y={8} width={2} height={2} rx={0.5} fill='none' />
|
|
44
|
+
<rect x={10} y={8} width={2} height={2} rx={0.5} fill='none' />
|
|
45
|
+
<rect x={7} y={11} width={2} height={2} rx={0.5} fill='none' />
|
|
46
|
+
<rect x={10} y={11} width={2} height={2} rx={0.5} fill='none' />
|
|
47
|
+
</svg>
|
|
48
|
+
)
|
|
49
|
+
break
|
|
50
|
+
default:
|
|
51
|
+
break
|
|
52
|
+
}
|
|
53
|
+
return icon
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default CalendarIcon
|
|
@@ -6,6 +6,35 @@ const CopyIcon = ({ color = 'green', size = 'normal' }) => {
|
|
|
6
6
|
let icon = <></>
|
|
7
7
|
switch (size) {
|
|
8
8
|
case 'small':
|
|
9
|
+
icon = (
|
|
10
|
+
<svg
|
|
11
|
+
width={16}
|
|
12
|
+
height={16}
|
|
13
|
+
viewBox='0 0 16 16'
|
|
14
|
+
fill='none'
|
|
15
|
+
xmlns='http://www.w3.org/2000/svg'
|
|
16
|
+
className={className}
|
|
17
|
+
>
|
|
18
|
+
<path
|
|
19
|
+
d='M6 13.5V4.94496C6 4.66882 6.22386 4.44496 6.5 4.44496H10.5365C10.6594 4.44496 10.7779 4.49019 10.8696 4.57203L13.833 7.21858C13.9393 7.31345 14 7.4491 14 7.59152V13.5C14 13.7761 13.7761 14 13.5 14H6.5C6.22386 14 6 13.7761 6 13.5Z'
|
|
20
|
+
stroke='none'
|
|
21
|
+
strokeLinecap='round'
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d='M10.5 7.78923V4.44496L14 7.78923H10.5Z'
|
|
25
|
+
stroke='none'
|
|
26
|
+
strokeLinecap='round'
|
|
27
|
+
strokeLinejoin='round'
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
d='M9.5 3.96723L7.36816 2.12196C7.27729 2.0433 7.16112 2.00001 7.04093 2.00001H4.61364H2.5C2.22386 2.00001 2 2.22386 2 2.50001L2.00001 10.6335C2.00001 10.9096 2.22386 11.1335 2.50001 11.1335H5.50001'
|
|
31
|
+
stroke='none'
|
|
32
|
+
strokeLinecap='round'
|
|
33
|
+
/>
|
|
34
|
+
</svg>
|
|
35
|
+
)
|
|
36
|
+
break
|
|
37
|
+
case 'normal':
|
|
9
38
|
icon = (
|
|
10
39
|
<svg
|
|
11
40
|
width={24}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import styles from './Icons.module.css'
|
|
3
|
+
|
|
4
|
+
const EditIcon = ({ color = 'green', size = 'normal' }) => {
|
|
5
|
+
const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
|
|
6
|
+
let icon = <></>
|
|
7
|
+
switch (size) {
|
|
8
|
+
case 'small':
|
|
9
|
+
icon = (
|
|
10
|
+
<svg width={16} height={16} viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg' className={className}>
|
|
11
|
+
<rect
|
|
12
|
+
x={10.0554}
|
|
13
|
+
y={4.50607}
|
|
14
|
+
width={2.11765}
|
|
15
|
+
height={7.76471}
|
|
16
|
+
transform='rotate(45 10.0554 4.50607)'
|
|
17
|
+
stroke='none'
|
|
18
|
+
strokeLinejoin='round'
|
|
19
|
+
/>
|
|
20
|
+
<path
|
|
21
|
+
d='M6.06234 11.4939L4.56494 9.99654L3.81624 12.2426L6.06234 11.4939Z'
|
|
22
|
+
stroke='none'
|
|
23
|
+
strokeLinejoin='round'
|
|
24
|
+
/>
|
|
25
|
+
<path
|
|
26
|
+
d='M10.8456 3.71577C11.2362 3.32525 11.8693 3.32525 12.2598 3.71577L12.343 3.79896C12.7336 4.18949 12.7336 4.82265 12.343 5.21318L11.5527 6.00347L10.0553 4.50607L10.8456 3.71577Z'
|
|
27
|
+
stroke='none'
|
|
28
|
+
/>
|
|
29
|
+
</svg>
|
|
30
|
+
)
|
|
31
|
+
break
|
|
32
|
+
default:
|
|
33
|
+
break
|
|
34
|
+
}
|
|
35
|
+
return icon
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default EditIcon
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import styles from './Icons.module.css'
|
|
3
|
+
const LiveIcon = ({ color = 'green', size = 'normal' }) => {
|
|
4
|
+
const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
|
|
5
|
+
let icon = <></>
|
|
6
|
+
switch (size) {
|
|
7
|
+
case 'small':
|
|
8
|
+
icon = (
|
|
9
|
+
<svg
|
|
10
|
+
width={16}
|
|
11
|
+
height={16}
|
|
12
|
+
viewBox='0 0 16 16'
|
|
13
|
+
fill='none'
|
|
14
|
+
xmlns='http://www.w3.org/2000/svg'
|
|
15
|
+
className={className}
|
|
16
|
+
>
|
|
17
|
+
<circle cx={8} cy={8.75137} r={1.5} fill='none' />
|
|
18
|
+
<path
|
|
19
|
+
d='M6 6.51529C5.38625 7.06461 5 7.8629 5 8.7514C5 9.6399 5.38625 10.4382 6 10.9875M10 6.51529C10.6137 7.06461 11 7.8629 11 8.7514C11 9.6399 10.6137 10.4382 10 10.9875'
|
|
20
|
+
stroke='none'
|
|
21
|
+
strokeLinecap='round'
|
|
22
|
+
strokeLinejoin='round'
|
|
23
|
+
/>
|
|
24
|
+
<path
|
|
25
|
+
d='M11 5.39722C11.9206 6.2212 12.5 7.41863 12.5 8.75138C12.5 10.0841 11.9206 11.2816 11 12.1055M5 5.39722C4.07938 6.2212 3.5 7.41863 3.5 8.75138C3.5 10.0841 4.07938 11.2816 5 12.1055'
|
|
26
|
+
stroke='none'
|
|
27
|
+
strokeLinecap='round'
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
d='M12 4.27916C13.2275 5.3778 14 6.97437 14 8.75137C14 10.6328 13.134 12.312 11.779 13.412M4.33558 4C2.91494 5.09726 2 6.81747 2 8.75137C2 10.5434 2.78563 12.152 4.03126 13.2514'
|
|
31
|
+
stroke='none'
|
|
32
|
+
strokeLinecap='round'
|
|
33
|
+
/>
|
|
34
|
+
</svg>
|
|
35
|
+
)
|
|
36
|
+
break
|
|
37
|
+
default:
|
|
38
|
+
break
|
|
39
|
+
}
|
|
40
|
+
return icon
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default LiveIcon
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import styles from './Icons.module.css'
|
|
3
|
+
const PlayIcon = ({ color = 'green', size = 'normal' }) => {
|
|
4
|
+
const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
|
|
5
|
+
let icon = <></>
|
|
6
|
+
switch (size) {
|
|
7
|
+
case 'small':
|
|
8
|
+
icon = (
|
|
9
|
+
<svg width={16} height={16} viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg' className={className}>
|
|
10
|
+
<path d='M2 2L14 8L2 14V2Z' stroke='none' strokeLinecap='round' strokeLinejoin='round' />
|
|
11
|
+
</svg>
|
|
12
|
+
)
|
|
13
|
+
break
|
|
14
|
+
default:
|
|
15
|
+
break
|
|
16
|
+
}
|
|
17
|
+
return icon
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default PlayIcon
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import styles from './Icons.module.css'
|
|
3
|
+
const StopIcon = ({ color = 'green', size = 'normal' }) => {
|
|
4
|
+
const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
|
|
5
|
+
let icon = <></>
|
|
6
|
+
switch (size) {
|
|
7
|
+
case 'small':
|
|
8
|
+
icon = (
|
|
9
|
+
<svg width={16} height={16} viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg' className={className}>
|
|
10
|
+
<circle cx={8} cy={8} r={6} stroke='none' />
|
|
11
|
+
<path d='M3.5 12L12 3.5' stroke='none' strokeLinecap='round' strokeLinejoin='round' />
|
|
12
|
+
</svg>
|
|
13
|
+
)
|
|
14
|
+
break
|
|
15
|
+
default:
|
|
16
|
+
break
|
|
17
|
+
}
|
|
18
|
+
return icon
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default StopIcon
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import styles from './Icons.module.css'
|
|
3
|
+
const TerminalIcon = ({ color = 'green', size = 'normal' }) => {
|
|
4
|
+
const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
|
|
5
|
+
let icon = <></>
|
|
6
|
+
switch (size) {
|
|
7
|
+
case 'small':
|
|
8
|
+
icon = (
|
|
9
|
+
<svg width={16} height={16} viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg' className={className}>
|
|
10
|
+
<rect x={2} y={2} width={12} height={12} rx={1} stroke='none' />
|
|
11
|
+
<path d='M4 9L6 7L4 5' stroke='none' strokeLinecap='round' strokeLinejoin='round' />
|
|
12
|
+
<path d='M7 11H11.5' stroke='none' strokeLinecap='round' strokeLinejoin='round' />
|
|
13
|
+
</svg>
|
|
14
|
+
)
|
|
15
|
+
break
|
|
16
|
+
default:
|
|
17
|
+
break
|
|
18
|
+
}
|
|
19
|
+
return icon
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default TerminalIcon
|
|
@@ -4,6 +4,9 @@ import ApiEmptyIcon from './ApiEmptyIcon'
|
|
|
4
4
|
import AppIcon from './AppIcon'
|
|
5
5
|
import AppListIcon from './AppListIcon'
|
|
6
6
|
import AppEmptyIcon from './AppEmptyIcon'
|
|
7
|
+
import CalendarIcon from './CalendarIcon'
|
|
8
|
+
import Calendar1Icon from './Calendar1Icon'
|
|
9
|
+
import Calendar7Icon from './Calendar7Icon'
|
|
7
10
|
import CircleAddIcon from './CircleAddIcon'
|
|
8
11
|
import CircleBackIcon from './CircleBackIcon'
|
|
9
12
|
import CircleExclamationIcon from './CircleExclamationIcon'
|
|
@@ -12,11 +15,16 @@ import CircleCloseHoverIcon from './CircleCloseHoverIcon'
|
|
|
12
15
|
import CloseIcon from './CloseIcon'
|
|
13
16
|
import CopyIcon from './CopyIcon'
|
|
14
17
|
import CreatedWorkspaceIcon from './CreatedWorkspaceIcon'
|
|
18
|
+
import DynamicWorkspaceIcon from './DynamicWorkspaceIcon'
|
|
19
|
+
import EditIcon from './EditIcon'
|
|
15
20
|
import GearIcon from './GearIcon'
|
|
21
|
+
import LiveIcon from './LiveIcon'
|
|
16
22
|
import MetricsIcon from './MetricsIcon'
|
|
17
|
-
import
|
|
18
|
-
import StaticWorkspaceIcon from './StaticWorkspaceIcon'
|
|
23
|
+
import PlayIcon from './PlayIcon'
|
|
19
24
|
import PullRequestIcon from './PullRequestIcon'
|
|
25
|
+
import StaticWorkspaceIcon from './StaticWorkspaceIcon'
|
|
26
|
+
import StopIcon from './StopIcon'
|
|
27
|
+
import TerminalIcon from './TerminalIcon'
|
|
20
28
|
import TriangleExclamationIcon from './TriangleExclamationIcon'
|
|
21
29
|
import UpgradeIcon from './UpgradeIcon'
|
|
22
30
|
|
|
@@ -27,6 +35,9 @@ export default {
|
|
|
27
35
|
AppIcon,
|
|
28
36
|
AppListIcon,
|
|
29
37
|
AppEmptyIcon,
|
|
38
|
+
CalendarIcon,
|
|
39
|
+
Calendar1Icon,
|
|
40
|
+
Calendar7Icon,
|
|
30
41
|
CircleAddIcon,
|
|
31
42
|
CircleBackIcon,
|
|
32
43
|
CircleExclamationIcon,
|
|
@@ -35,11 +46,16 @@ export default {
|
|
|
35
46
|
CloseIcon,
|
|
36
47
|
CopyIcon,
|
|
37
48
|
CreatedWorkspaceIcon,
|
|
49
|
+
DynamicWorkspaceIcon,
|
|
38
50
|
GearIcon,
|
|
51
|
+
EditIcon,
|
|
52
|
+
LiveIcon,
|
|
39
53
|
MetricsIcon,
|
|
40
|
-
|
|
41
|
-
StaticWorkspaceIcon,
|
|
54
|
+
PlayIcon,
|
|
42
55
|
PullRequestIcon,
|
|
56
|
+
StaticWorkspaceIcon,
|
|
57
|
+
StopIcon,
|
|
58
|
+
TerminalIcon,
|
|
43
59
|
TriangleExclamationIcon,
|
|
44
60
|
UpgradeIcon
|
|
45
61
|
}
|
|
@@ -100,9 +100,15 @@ DisabledGreen.args = {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
export const DisabledRed = DisabledTemplate.bind({})
|
|
103
|
-
|
|
104
103
|
DisabledRed.args = {
|
|
105
104
|
label: 'A simple button',
|
|
106
105
|
color: 'error-red',
|
|
107
106
|
disabled: true
|
|
108
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,5 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PlatformaticIcon from '../components/PlatformaticIcon'
|
|
3
|
+
import Icons from '../components/icons'
|
|
4
|
+
|
|
5
|
+
const divStyle = {
|
|
6
|
+
width: '100%',
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexGap: '10px'
|
|
9
|
+
}
|
|
3
10
|
|
|
4
11
|
export default {
|
|
5
12
|
title: 'Platformatic/PlatformaticIcon',
|
|
@@ -12,3 +19,17 @@ PlatformaticIconDefault.args = {
|
|
|
12
19
|
iconName: 'CopyIcon',
|
|
13
20
|
onClick: () => alert('clicked')
|
|
14
21
|
}
|
|
22
|
+
|
|
23
|
+
const AllIconsTemplate = (args) => {
|
|
24
|
+
const icons = Object.values(Icons)
|
|
25
|
+
return (
|
|
26
|
+
<div style={divStyle}>
|
|
27
|
+
{icons.map(IconComponent => <PlatformaticIcon key={IconComponent.name} iconName={IconComponent.name} {...args} />)}
|
|
28
|
+
</div>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
export const PlatformaticIconAll = AllIconsTemplate.bind({})
|
|
32
|
+
PlatformaticIconAll.args = {
|
|
33
|
+
color: 'white',
|
|
34
|
+
size: 'small'
|
|
35
|
+
}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
import React, { useState } from 'react'
|
|
3
3
|
import Input from '../../components/forms/Input'
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
const divStyle = {
|
|
6
|
+
width: '100%',
|
|
7
|
+
height: 'auto',
|
|
8
|
+
padding: '20px',
|
|
9
|
+
backgroundColor: 'white'
|
|
10
|
+
}
|
|
5
11
|
|
|
6
12
|
export default {
|
|
7
13
|
title: 'Platformatic/Forms/Input',
|
|
8
|
-
component: Input
|
|
14
|
+
component: Input,
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (
|
|
17
|
+
<div style={divStyle}>
|
|
18
|
+
<Story />
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
]
|
|
9
22
|
}
|
|
10
23
|
|
|
11
24
|
const Template = (args) => <Input {...args} />
|
|
@@ -63,7 +76,14 @@ export const IconBeforeAndAfter = Template.bind({})
|
|
|
63
76
|
IconBeforeAndAfter.args = {
|
|
64
77
|
name: 'test',
|
|
65
78
|
placeholder: 'Platformatic',
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
beforeIcon: {
|
|
80
|
+
iconName: 'CopyIcon',
|
|
81
|
+
color: 'main-dark-blue',
|
|
82
|
+
size: 'small',
|
|
83
|
+
onClick: () => { alert('clicked') }
|
|
84
|
+
},
|
|
85
|
+
afterIcon: {
|
|
86
|
+
iconName: 'CircleAddIcon',
|
|
87
|
+
color: 'red'
|
|
88
|
+
}
|
|
69
89
|
}
|