@platformatic/ui-components 0.1.55 → 0.1.57
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/ListElement.jsx +47 -14
- package/src/components/ListElement.module.css +16 -11
- 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/src/stories/List.stories.jsx +13 -1
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
|
|
|
@@ -1,23 +1,56 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import PlatformaticIcon from './PlatformaticIcon'
|
|
4
4
|
import styles from './ListElement.module.css'
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
function List ({ title, detail, marginSize, titleAspect }) {
|
|
7
|
+
let className = `${styles.container} `
|
|
8
|
+
className += styles[`margin-${marginSize}`]
|
|
9
|
+
|
|
10
|
+
let classNameTitle = `${styles.title} `
|
|
11
|
+
classNameTitle += styles[`${titleAspect}`]
|
|
12
|
+
|
|
6
13
|
return (
|
|
7
|
-
<div className={
|
|
8
|
-
<div className={styles.
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
<div className={styles.textCol}>
|
|
14
|
-
<div className={styles.title} data-testid='list-element-title'>
|
|
14
|
+
<div className={className}>
|
|
15
|
+
<div className={styles.row}>
|
|
16
|
+
<PlatformaticIcon iconName='CircleCheckMarkIcon' color='green' data-testid='list-element-title-icon' onClick={null} />
|
|
17
|
+
<div className={classNameTitle} data-testid='list-element-title'>
|
|
15
18
|
{title}
|
|
16
19
|
</div>
|
|
17
|
-
<div data-test-id='list-element-detail'>
|
|
18
|
-
{detail}
|
|
19
|
-
</div>
|
|
20
20
|
</div>
|
|
21
|
+
{detail &&
|
|
22
|
+
(
|
|
23
|
+
<div className={styles.textCol} data-test-id='list-element-detail'>
|
|
24
|
+
{detail}
|
|
25
|
+
</div>
|
|
26
|
+
)}
|
|
21
27
|
</div>
|
|
22
28
|
)
|
|
23
29
|
}
|
|
30
|
+
List.propTypes = {
|
|
31
|
+
/**
|
|
32
|
+
* title
|
|
33
|
+
*/
|
|
34
|
+
title: PropTypes.string,
|
|
35
|
+
/**
|
|
36
|
+
* detail
|
|
37
|
+
*/
|
|
38
|
+
detail: PropTypes.string,
|
|
39
|
+
/**
|
|
40
|
+
* marginSize
|
|
41
|
+
*/
|
|
42
|
+
marginSize: PropTypes.oneOf(['small', 'medium']),
|
|
43
|
+
/**
|
|
44
|
+
* titleAspect
|
|
45
|
+
*/
|
|
46
|
+
titleAspect: PropTypes.oneOf(['boldAndGreen', 'lightAndWhite'])
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
List.defaultProps = {
|
|
50
|
+
title: '',
|
|
51
|
+
detail: '',
|
|
52
|
+
marginSize: 'medium',
|
|
53
|
+
titleAspect: 'boldAndGreen'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default List
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
.container {
|
|
2
|
-
@apply flex flex-
|
|
2
|
+
@apply flex flex-col my-4
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@apply flex flex-col w-6
|
|
4
|
+
.margin-medium {
|
|
5
|
+
@apply my-4
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@apply text-light-green
|
|
7
|
+
.margin-small {
|
|
8
|
+
@apply my-2
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
.title {
|
|
14
|
-
@apply
|
|
11
|
+
@apply w-full;
|
|
12
|
+
}
|
|
13
|
+
.boldAndGreen {
|
|
14
|
+
@apply text-light-green font-bold;
|
|
15
|
+
}
|
|
16
|
+
.lightAndWhite {
|
|
17
|
+
@apply text-white font-light;
|
|
18
|
+
}
|
|
19
|
+
.row {
|
|
20
|
+
@apply flex gap-x-2 items-center w-full;
|
|
15
21
|
}
|
|
16
|
-
|
|
17
22
|
.textCol {
|
|
18
|
-
@apply flex flex-col text-white text-justify w-full
|
|
23
|
+
@apply flex flex-col text-white text-justify w-full ml-6;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
.detailSpace {
|
|
@@ -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
|
+
}
|
|
@@ -15,7 +15,7 @@ ListWithNoElements.args = {
|
|
|
15
15
|
|
|
16
16
|
const TemplateWithElements = (args) => (
|
|
17
17
|
<List {...args}>
|
|
18
|
-
<ListElement title='List Element 1' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' />
|
|
18
|
+
<ListElement title='List Element 1' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' titleAspect='boldAndGreen' />
|
|
19
19
|
<ListElement title='List Element 2' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' />
|
|
20
20
|
</List>
|
|
21
21
|
)
|
|
@@ -27,3 +27,15 @@ ListWithElements.args = {
|
|
|
27
27
|
|
|
28
28
|
export const ListWithElementsNoTitle = TemplateWithElements.bind({})
|
|
29
29
|
ListWithElementsNoTitle.args = {}
|
|
30
|
+
|
|
31
|
+
const TemplateWithElementsVariants = (args) => (
|
|
32
|
+
<List {...args}>
|
|
33
|
+
<ListElement title='List Element 1' titleAspect='boldAndGreen' marginSize='small' />
|
|
34
|
+
<ListElement title='List Element 2' titleAspect='lightAndWhite' marginSize='small' />
|
|
35
|
+
</List>
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
export const ListWithElementsVariants = TemplateWithElementsVariants.bind({})
|
|
39
|
+
ListWithElementsVariants.args = {
|
|
40
|
+
title: 'List Title'
|
|
41
|
+
}
|