@platformatic/ui-components 0.1.55 → 0.1.56
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/InfoBox.jsx +11 -6
- package/src/components/PlatformaticIcon.jsx +14 -11
- package/src/components/icons/ArrowUpIcon.jsx +4 -4
- package/src/components/icons/LayersIcon.jsx +4 -4
- package/src/components/icons/WorkspaceFailIcon.jsx +6 -6
- package/src/stories/InfoBox.stories.jsx +14 -2
package/package.json
CHANGED
|
@@ -5,10 +5,10 @@ import styles from './InfoBox.module.css'
|
|
|
5
5
|
import Button from './Button'
|
|
6
6
|
import PlatformaticIcon from './PlatformaticIcon'
|
|
7
7
|
|
|
8
|
-
function InfoBox ({ children,
|
|
8
|
+
function InfoBox ({ children, iconName, iconColor, helpText, buttonProps }) {
|
|
9
9
|
return (
|
|
10
10
|
<div className={styles.container}>
|
|
11
|
-
<PlatformaticIcon size='extra-large' iconName={
|
|
11
|
+
<PlatformaticIcon size='extra-large' iconName={iconName} color={iconColor} />
|
|
12
12
|
{children}
|
|
13
13
|
<p className={styles.helpText}>{helpText}</p>
|
|
14
14
|
{buttonProps && (<Button type='button' size='extra-large' label={buttonProps.label} color={buttonProps.color} backgroundColor={buttonProps.backgroundColor} onClick={() => buttonProps.onClick()} fullWidth bold />)}
|
|
@@ -22,9 +22,13 @@ InfoBox.propTypes = {
|
|
|
22
22
|
*/
|
|
23
23
|
children: PropTypes.node,
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* iconName
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
iconName: PropTypes.string,
|
|
28
|
+
/**
|
|
29
|
+
* iconColor
|
|
30
|
+
*/
|
|
31
|
+
iconColor: PropTypes.oneOf(['green', 'white', 'main-dark-blue', 'red']),
|
|
28
32
|
/**
|
|
29
33
|
* helpText
|
|
30
34
|
*/
|
|
@@ -42,8 +46,9 @@ InfoBox.propTypes = {
|
|
|
42
46
|
|
|
43
47
|
InfoBox.defaultProps = {
|
|
44
48
|
children: null,
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
iconName: '',
|
|
50
|
+
iconColor: 'green',
|
|
51
|
+
helpText: '',
|
|
47
52
|
buttonProps: null
|
|
48
53
|
}
|
|
49
54
|
|
|
@@ -5,15 +5,18 @@ import Icons from './icons'
|
|
|
5
5
|
import styles from './PlatformaticIcon.module.css'
|
|
6
6
|
|
|
7
7
|
function PlatformaticIcon ({ iconName, color, onClick, size, classes, tip }) {
|
|
8
|
-
let icon =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
|
|
8
|
+
let icon = <></>
|
|
9
|
+
if (iconName) {
|
|
10
|
+
icon = React.createElement(Icons[`${iconName}`], {
|
|
11
|
+
color,
|
|
12
|
+
size,
|
|
13
|
+
tip
|
|
14
|
+
})
|
|
15
|
+
if (onClick) {
|
|
16
|
+
let className = styles.cursorPointer
|
|
17
|
+
if (classes) className += ` ${classes}`
|
|
18
|
+
icon = (<span className={className} onClick={onClick}>{icon}</span>)
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
return icon
|
|
19
22
|
}
|
|
@@ -46,12 +49,12 @@ PlatformaticIcon.propTypes = {
|
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
PlatformaticIcon.defaultProps = {
|
|
49
|
-
iconName:
|
|
52
|
+
iconName: '',
|
|
50
53
|
color: 'green',
|
|
51
54
|
size: 'small',
|
|
52
55
|
onClick: () => {},
|
|
53
56
|
classes: null,
|
|
54
|
-
tip:
|
|
57
|
+
tip: ''
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
export default PlatformaticIcon
|
|
@@ -2,7 +2,7 @@ import * as React from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import styles from './Icons.module.css'
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const ArrowUpIcon = ({ color, size }) => {
|
|
6
6
|
const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
|
|
7
7
|
let icon = <></>
|
|
8
8
|
|
|
@@ -56,7 +56,7 @@ const ArrowDownIcon = ({ color, size }) => {
|
|
|
56
56
|
return icon
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
ArrowUpIcon.propTypes = {
|
|
60
60
|
/**
|
|
61
61
|
* color of text, icon and borders
|
|
62
62
|
*/
|
|
@@ -67,9 +67,9 @@ ArrowDownIcon.propTypes = {
|
|
|
67
67
|
size: PropTypes.oneOf(['small', 'medium', 'large', 'extra-large'])
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
ArrowUpIcon.defaultProps = {
|
|
71
71
|
color: 'main-dark-blue',
|
|
72
72
|
size: 'medium'
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export default
|
|
75
|
+
export default ArrowUpIcon
|
|
@@ -2,7 +2,7 @@ import * as React from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import styles from './Icons.module.css'
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const LayersIcon = ({ color, size }) => {
|
|
6
6
|
const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
|
|
7
7
|
let icon = <></>
|
|
8
8
|
|
|
@@ -62,7 +62,7 @@ const AddIcon = ({ color, size }) => {
|
|
|
62
62
|
return icon
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
LayersIcon.propTypes = {
|
|
66
66
|
/**
|
|
67
67
|
* color of text, icon and borders
|
|
68
68
|
*/
|
|
@@ -73,9 +73,9 @@ AddIcon.propTypes = {
|
|
|
73
73
|
size: PropTypes.oneOf(['small', 'medium', 'large', 'extra-large'])
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
LayersIcon.defaultProps = {
|
|
77
77
|
color: 'main-dark-blue',
|
|
78
78
|
size: 'medium'
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
export default
|
|
81
|
+
export default LayersIcon
|
|
@@ -76,12 +76,12 @@ const WorkspaceFailIcon = ({ color, size }) => {
|
|
|
76
76
|
xmlns='http://www.w3.org/2000/svg'
|
|
77
77
|
className={className}
|
|
78
78
|
>
|
|
79
|
-
<rect x={15} y={15} width={37.5} height={37.5} rx={1} stroke='none'
|
|
80
|
-
<rect x={45} y={105} width={30} height={37.7622} rx={1} transform='rotate(-180 45 105)' stroke='none'
|
|
81
|
-
<rect x={105} y={105} width={45} height={37.7622} rx={1} transform='rotate(-180 105 105)' stroke='none'
|
|
82
|
-
<circle cx={86.25} cy={33.75} r={18.75} stroke='none'
|
|
83
|
-
<path d='M82.2188 39.2499L91.2812 29.25' stroke='none'
|
|
84
|
-
<path d='M91.7499 38.781L81.75 29.7185' stroke='none'
|
|
79
|
+
<rect x={15} y={15} width={37.5} height={37.5} rx={1} stroke='none' strokeWidth={6} />
|
|
80
|
+
<rect x={45} y={105} width={30} height={37.7622} rx={1} transform='rotate(-180 45 105)' stroke='none' strokeWidth={6} />
|
|
81
|
+
<rect x={105} y={105} width={45} height={37.7622} rx={1} transform='rotate(-180 105 105)' stroke='none' strokeWidth={6} />
|
|
82
|
+
<circle cx={86.25} cy={33.75} r={18.75} stroke='none' strokeWidth={6} />
|
|
83
|
+
<path d='M82.2188 39.2499L91.2812 29.25' stroke='none' strokeWidth={6} strokeLinecap='round' strokeLinejoin='round' />
|
|
84
|
+
<path d='M91.7499 38.781L81.75 29.7185' stroke='none' strokeWidth={6} strokeLinecap='round' strokeLinejoin='round' />
|
|
85
85
|
|
|
86
86
|
</svg>
|
|
87
87
|
)
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
const Template = (args) => <InfoBox {...args}><p>this will be your custom title</p></InfoBox>
|
|
24
24
|
export const InfoBoxSample = Template.bind({})
|
|
25
25
|
InfoBoxSample.args = {
|
|
26
|
-
|
|
26
|
+
iconName: 'UpgradeIcon',
|
|
27
27
|
helpText: 'Helper text',
|
|
28
28
|
buttonProps: {
|
|
29
29
|
label: 'Sample button',
|
|
@@ -36,7 +36,7 @@ InfoBoxSample.args = {
|
|
|
36
36
|
const ContainedTemplate = (args) => <div style={{ maxWidth: '300px' }}><InfoBox {...args} /></div>
|
|
37
37
|
export const InfoBoxContained = ContainedTemplate.bind({})
|
|
38
38
|
InfoBoxContained.args = {
|
|
39
|
-
|
|
39
|
+
iconName: 'UpgradeIcon',
|
|
40
40
|
helpText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.',
|
|
41
41
|
buttonProps: {
|
|
42
42
|
label: 'Sample button',
|
|
@@ -44,3 +44,15 @@ InfoBoxContained.args = {
|
|
|
44
44
|
onClick: () => alert('Clicked ContainedTemplate')
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
export const InfoBoxErrorContained = ContainedTemplate.bind({})
|
|
49
|
+
InfoBoxErrorContained.args = {
|
|
50
|
+
iconName: 'WorkspaceFailIcon',
|
|
51
|
+
iconColor: 'red',
|
|
52
|
+
helpText: 'Write your own content',
|
|
53
|
+
buttonProps: {
|
|
54
|
+
label: 'Sample button',
|
|
55
|
+
color: 'white',
|
|
56
|
+
onClick: () => alert('Clicked ContainedErrorTemplate')
|
|
57
|
+
}
|
|
58
|
+
}
|