@platformatic/ui-components 0.1.44 → 0.1.46

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 CHANGED
@@ -675,6 +675,10 @@ video {
675
675
  color: rgb(2 120 63 / var(--tw-text-opacity));
676
676
  }
677
677
 
678
+ .underline {
679
+ text-decoration-line: underline;
680
+ }
681
+
678
682
  .blur {
679
683
  --tw-blur: blur(8px);
680
684
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@platformatic/ui-components",
3
3
  "description": "Platformatic UI Components",
4
- "version": "0.1.44",
4
+ "version": "0.1.46",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -5,16 +5,20 @@ import styles from './Button.module.css'
5
5
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
6
6
 
7
7
  function Button (props) {
8
- const { icon, label, color, backgroundColor, size, disabled, bold, underlineEffect, bordered, ...rest } = props
8
+ const { icon, label, color, backgroundColor, size, disabled, bold, hoverEffect, bordered, fullWidth, ...rest } = props
9
9
  let className = `${styles.button} ${styles['background-color-' + backgroundColor]} ${styles['color-' + color]} ${styles['button-' + size]}`
10
10
  if (!bordered) className += ` ${styles['no-border']}`
11
11
  if (disabled) {
12
12
  className += ` ${styles.disabled}`
13
13
  } else {
14
- if (underlineEffect) className += ` ${styles['underline-effect']}`
14
+ if (hoverEffect === 'hover') {
15
+ className += ` ${styles['hover-' + backgroundColor]}`
16
+ } else {
17
+ className += ` ${styles['underline-effect']}`
18
+ }
15
19
  }
16
20
  if (bold) className += ` ${styles.fontBold}`
17
-
21
+ if (fullWidth) className += ` ${styles.fullWidth}`
18
22
  return (
19
23
  <button className={className} disabled={disabled} alt={label} {...rest}>
20
24
  {icon ? <FontAwesomeIcon icon={icon} className={`${styles['margin-right-' + size]}`} data-testid='button-icon' /> : null}
@@ -53,13 +57,17 @@ Button.propTypes = {
53
57
  */
54
58
  bold: PropTypes.bool,
55
59
  /**
56
- * Underline effect on hover
60
+ * Effect on hover
57
61
  */
58
- underlineEffect: PropTypes.bool,
62
+ hoverEffect: PropTypes.oneOf(['hover', 'underline']),
59
63
  /**
60
64
  * Apply border: default true
61
65
  */
62
- bordered: PropTypes.bool
66
+ bordered: PropTypes.bool,
67
+ /**
68
+ * Full Width: default false
69
+ */
70
+ fullWidth: PropTypes.bool
63
71
  }
64
72
 
65
73
  Button.defaultProps = {
@@ -68,8 +76,9 @@ Button.defaultProps = {
68
76
  disabled: false,
69
77
  size: 'large',
70
78
  bold: false,
71
- underlineEffect: false,
72
- bordered: true
79
+ hoverEffect: 'hover',
80
+ bordered: true,
81
+ fullWidth: false
73
82
  }
74
83
 
75
84
  export default Button
@@ -39,10 +39,10 @@
39
39
  .background-color-main-dark-blue{
40
40
  @apply bg-main-dark-blue !important;
41
41
  }
42
- .background-color-dark-blue{
42
+ .background-color-dark-blue {
43
43
  @apply bg-dark-blue !important;
44
44
  }
45
- .background-color-light-blue{
45
+ .background-color-light-blue {
46
46
  @apply bg-light-blue !important;
47
47
  }
48
48
  .background-color-white{
@@ -93,6 +93,36 @@
93
93
  .disabled {
94
94
  @apply opacity-30 cursor-default;
95
95
  }
96
+ .hover-main-green {
97
+ @apply hover:shadow-main-green;
98
+ }
99
+ .hover-light-green {
100
+ @apply hover:shadow-light-green;
101
+ }
102
+ .hover-dark-green {
103
+ @apply hover:shadow-dark-green;
104
+ }
105
+ .hover-main-dark-blue {
106
+ @apply hover:shadow-main-dark-blue;
107
+ }
108
+ .hover-dark-blue {
109
+ @apply hover:shadow-dark-blue;
110
+ }
111
+ .hover-light-blue {
112
+ @apply hover:shadow-light-blue;
113
+ }
114
+ .hover-white{
115
+ @apply hover:shadow-wrap;
116
+ }
117
+ .hover-error-red {
118
+ @apply hover:shadow-error-red;
119
+ }
120
+ .hover-tertiary-blue {
121
+ @apply hover:shadow-tertiary-blue;
122
+ }
96
123
  .underline-effect {
97
124
  @apply hover:underline;
125
+ }
126
+ .fullWidth {
127
+ @apply w-full;
98
128
  }
@@ -0,0 +1,60 @@
1
+ 'use strict'
2
+ import React from 'react'
3
+ import PropTypes from 'prop-types'
4
+ import styles from './InfoBox.module.css'
5
+ import Button from './Button'
6
+ import Icons from './icons'
7
+
8
+ function renderItemIcon (iconName, color) {
9
+ if (iconName) {
10
+ return React.createElement(Icons[`${iconName}`], {
11
+ size: 'extra-large',
12
+ color
13
+ })
14
+ }
15
+ return (<></>)
16
+ }
17
+
18
+ function InfoBox ({ children, iconLogo, helpText, buttonProps }) {
19
+ return (
20
+ <div className={styles.container}>
21
+ {renderItemIcon(iconLogo)}
22
+ {children}
23
+ <p className={styles.helpText}>{helpText}</p>
24
+ {buttonProps && (<Button type='button' size='extra-large' label={buttonProps.label} color={buttonProps.color} backgroundColor={buttonProps.backgroundColor} onClick={() => buttonProps.onClick()} fullWidth />)}
25
+ </div>
26
+ )
27
+ }
28
+
29
+ InfoBox.propTypes = {
30
+ /**
31
+ * children
32
+ */
33
+ children: PropTypes.node,
34
+ /**
35
+ * iconLogo
36
+ */
37
+ iconLogo: PropTypes.string,
38
+ /**
39
+ * helpText
40
+ */
41
+ helpText: PropTypes.string,
42
+ /**
43
+ * background color of the button
44
+ */
45
+ buttonProps: PropTypes.shape({
46
+ label: PropTypes.string,
47
+ backgroundColor: PropTypes.string,
48
+ color: PropTypes.string,
49
+ onClick: PropTypes.func
50
+ })
51
+ }
52
+
53
+ InfoBox.defaultProps = {
54
+ children: null,
55
+ iconLogo: null,
56
+ helpText: null,
57
+ buttonProps: null
58
+ }
59
+
60
+ export default InfoBox
@@ -0,0 +1,6 @@
1
+ .container {
2
+ @apply bg-main-dark-blue border-0 rounded-md p-3 flex flex-col items-center gap-y-2 w-full;
3
+ }
4
+ .helpText {
5
+ @apply text-sm text-center mx-6 text-white font-normal;
6
+ }
@@ -42,7 +42,7 @@ function Sidebar (props) {
42
42
  ? (
43
43
  <>
44
44
  <button type='button' className={styles.buttonExpand} onClick={() => { setCollapsed(false) }}>
45
- <Icons.PuzzleIcon color='white' />
45
+ <Icons.StaticWorkspaceIcon color='white' />
46
46
  </button>
47
47
  <div className={styles.titleCollapsed} data-testid='lateral-bar-title'>
48
48
  {title}
@@ -1,15 +1,84 @@
1
1
  import React from 'react'
2
+ import PropTypes from 'prop-types'
2
3
  import styles from './Preview.module.css'
3
4
  import HorizontalSeparator from '../HorizontalSeparator'
5
+ import Icons from '../icons'
4
6
 
5
- export default function Preview ({ title, value, isLink = false }) {
7
+ function renderItemIcon (iconName, color) {
8
+ if (iconName) {
9
+ return React.createElement(Icons[`${iconName}`], {
10
+ color,
11
+ size: 'small'
12
+ })
13
+ }
14
+ return (<></>)
15
+ }
16
+
17
+ function renderLink (value) {
18
+ return (<a className={styles.link} href={value} target='_blank' rel='noreferrer'>{value}</a>)
19
+ }
20
+
21
+ function renderParagraph (value, afterValueIcon, afterValueColor, onClickAfterValueIcon) {
22
+ return (
23
+ <>
24
+ <p className={styles.value}>
25
+ {value}
26
+ {afterValueIcon && (<span className={styles.afterIcon} onClick={onClickAfterValueIcon}>{renderItemIcon(afterValueIcon, afterValueColor)}</span>)}
27
+ </p>
28
+ </>
29
+ )
30
+ }
31
+ function Preview ({ title, value, isLink, children, afterValueIcon, afterValueColor, onClickAfterValueIcon }) {
6
32
  return (
7
33
  <>
8
34
  <div className={styles.container}>
9
35
  <p className={styles.title}>{title}</p>
10
- {isLink ? <a className={styles.link} href={value} target='_blank' rel='noreferrer'>{value}</a> : <p className={styles.value}>{value}</p>}
36
+ {isLink ? renderLink(value) : renderParagraph(value, afterValueIcon, afterValueColor, onClickAfterValueIcon)}
11
37
  </div>
38
+ {children}
12
39
  <HorizontalSeparator color='main-dark-green' opacity={20} marginBottom={10} marginTop={10} />
13
40
  </>
14
41
  )
15
42
  }
43
+
44
+ Preview.propTypes = {
45
+ /**
46
+ * title
47
+ */
48
+ title: PropTypes.string,
49
+ /**
50
+ * value
51
+ */
52
+ value: PropTypes.string,
53
+ /**
54
+ * isLink
55
+ */
56
+ isLink: PropTypes.bool,
57
+ /**
58
+ * color of border
59
+ */
60
+ children: PropTypes.node,
61
+ /**
62
+ * afterValueIcon
63
+ */
64
+ afterValueIcon: PropTypes.object,
65
+ /**
66
+ * afterValueIconColor
67
+ */
68
+ afterValueIconColor: PropTypes.oneOf(['error-red', 'main-dark-blue', 'white']),
69
+ /**
70
+ * onClickAfterValueIcon
71
+ */
72
+ onClickAfterValueIcon: PropTypes.func
73
+ }
74
+
75
+ Preview.defaultProps = {
76
+ title: '',
77
+ value: '',
78
+ isLink: false,
79
+ afterValueIconColor: 'main-dark-blue',
80
+ afterValueIcon: null,
81
+ onClickAfterValueIcon: () => {}
82
+ }
83
+
84
+ export default Preview
@@ -1,12 +1,15 @@
1
1
  .container {
2
2
  @apply flex flex-col
3
3
  }
4
- .title{
4
+ .title {
5
5
  @apply text-sm text-main-dark-blue pb-1;
6
6
  }
7
- .value{
8
- @apply text-xl font-semibold text-main-dark-blue;
7
+ .value {
8
+ @apply text-xl font-semibold text-main-dark-blue inline-flex;
9
9
  }
10
10
  .link {
11
11
  @apply font-semibold;
12
12
  }
13
+ .afterIcon {
14
+ @apply ml-3 cursor-pointer;
15
+ }
@@ -0,0 +1,46 @@
1
+ import * as React from 'react'
2
+ import styles from './Icons.module.css'
3
+
4
+ const CopyIcon = ({ 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={24}
12
+ height={25}
13
+ viewBox='0 0 24 25'
14
+ fill='none'
15
+ xmlns='http://www.w3.org/2000/svg'
16
+ className={className}
17
+ >
18
+ <path
19
+ d='M9 21.3333V8.00073C9 7.72459 9.22386 7.50073 9.5 7.50073H15.9001C16.023 7.50073 16.1416 7.54597 16.2332 7.6278L20.833 11.7357C20.9393 11.8306 21 11.9662 21 12.1086V21.3333C21 21.6094 20.7761 21.8333 20.5 21.8333H9.5C9.22386 21.8333 9 21.6094 9 21.3333Z'
20
+ stroke='none'
21
+ strokeWidth={1.5}
22
+ strokeLinecap='round'
23
+ />
24
+ <path
25
+ d='M15.75 12.5171V7.50073L21 12.5171H15.75Z'
26
+ stroke='none'
27
+ strokeWidth={1.5}
28
+ strokeLinecap='round'
29
+ strokeLinejoin='round'
30
+ />
31
+ <path
32
+ d='M14.25 6.78409L10.9818 3.95521C10.8909 3.87655 10.7748 3.83326 10.6546 3.83326H6.92045H3.5C3.22386 3.83326 3 4.05712 3 4.33326L3.00001 17.0335C3.00001 17.3096 3.22387 17.5335 3.50001 17.5335H8.25001'
33
+ stroke='none'
34
+ strokeWidth={1.5}
35
+ strokeLinecap='round'
36
+ />
37
+ </svg>
38
+ )
39
+ break
40
+ default:
41
+ break
42
+ }
43
+ return icon
44
+ }
45
+
46
+ export default CopyIcon
@@ -0,0 +1,70 @@
1
+ import * as React from 'react'
2
+ import styles from './Icons.module.css'
3
+
4
+ const CreatedWorkspaceIcon = ({ color = 'green', size = 'normal' }) => {
5
+ const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
6
+ let icon = <></>
7
+ switch (size) {
8
+ case 'extra-large':
9
+ icon = (
10
+ <svg
11
+ width={120}
12
+ height={120}
13
+ viewBox='0 0 120 120'
14
+ fill='none'
15
+ xmlns='http://www.w3.org/2000/svg'
16
+ className={className}
17
+ >
18
+ <rect
19
+ x={15}
20
+ y={15}
21
+ width={37.5}
22
+ height={37.5}
23
+ rx={1}
24
+ stroke='none'
25
+ strokeWidth={6.5}
26
+ />
27
+ <rect
28
+ x={45}
29
+ y={105}
30
+ width={30}
31
+ height={37.7622}
32
+ rx={1}
33
+ transform='rotate(-180 45 105)'
34
+ stroke='none'
35
+ strokeWidth={6.5}
36
+ />
37
+ <rect
38
+ x={105}
39
+ y={105}
40
+ width={45}
41
+ height={37.7622}
42
+ rx={1}
43
+ transform='rotate(-180 105 105)'
44
+ stroke='none'
45
+ strokeWidth={6.5}
46
+ />
47
+ <circle
48
+ cx={86.25}
49
+ cy={33.75}
50
+ r={18.75}
51
+ stroke='none'
52
+ strokeWidth={6.5}
53
+ />
54
+ <path
55
+ d='M76.875 33.7499L84.6875 39.9999L93.75 30'
56
+ stroke='none'
57
+ strokeWidth={6.5}
58
+ strokeLinecap='round'
59
+ strokeLinejoin='round'
60
+ />
61
+ </svg>
62
+ )
63
+ break
64
+ default:
65
+ break
66
+ }
67
+ return icon
68
+ }
69
+
70
+ export default CreatedWorkspaceIcon
@@ -0,0 +1,125 @@
1
+ import * as React from 'react'
2
+ import styles from './Icons.module.css'
3
+
4
+ const DynamicWorkspaceIcon = ({ color = 'green', size = 'normal', tip = '' }) => {
5
+ const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
6
+ let icon = (
7
+ <svg
8
+ width={40}
9
+ height={40}
10
+ viewBox='0 0 40 40'
11
+ fill='none'
12
+ xmlns='http://www.w3.org/2000/svg'
13
+ className={className}
14
+ data-tip={tip}
15
+ >
16
+ <rect
17
+ x={5}
18
+ y={5}
19
+ width={10}
20
+ height={12.5874}
21
+ rx={1}
22
+ stroke='none'
23
+ strokeWidth={2}
24
+ />
25
+ <path
26
+ d='M20 5L27.5 11.25L20 17.5V5Z'
27
+ stroke='none'
28
+ strokeWidth={2}
29
+ strokeLinecap='round'
30
+ strokeLinejoin='round'
31
+ />
32
+ <rect
33
+ x={35}
34
+ y={35}
35
+ width={10}
36
+ height={12.5874}
37
+ rx={1}
38
+ transform='rotate(-180 35 35)'
39
+ stroke='none'
40
+ strokeWidth={2}
41
+ />
42
+ <rect
43
+ x={20}
44
+ y={35}
45
+ width={15}
46
+ height={12.5874}
47
+ rx={1}
48
+ transform='rotate(-180 20 35)'
49
+ stroke='none'
50
+ strokeWidth={2}
51
+ />
52
+ <path
53
+ d='M27.5 15V17.5L35 11.25L27.5 5V7.5'
54
+ stroke='none'
55
+ strokeWidth={2}
56
+ strokeLinecap='round'
57
+ strokeLinejoin='round'
58
+ />
59
+ </svg>
60
+ )
61
+ switch (size) {
62
+ case 'small':
63
+ icon = (
64
+ <svg
65
+ width={24}
66
+ height={25}
67
+ viewBox='0 0 24 25'
68
+ fill='none'
69
+ xmlns='http://www.w3.org/2000/svg'
70
+ className={className}
71
+ data-tip={tip}
72
+ >
73
+ <rect
74
+ x={3}
75
+ y={3.5}
76
+ width={6}
77
+ height={7.55245}
78
+ rx={1}
79
+ stroke='none'
80
+ strokeWidth={1.5}
81
+ />
82
+ <path
83
+ d='M12 3.5L16.5 7.25L12 11V3.5Z'
84
+ stroke='none'
85
+ strokeWidth={1.5}
86
+ strokeLinecap='round'
87
+ strokeLinejoin='round'
88
+ />
89
+ <rect
90
+ x={21}
91
+ y={21.5}
92
+ width={6}
93
+ height={7.55245}
94
+ rx={1}
95
+ transform='rotate(-180 21 21.5)'
96
+ stroke='none'
97
+ strokeWidth={1.5}
98
+ />
99
+ <rect
100
+ x={12}
101
+ y={21.5}
102
+ width={9}
103
+ height={7.55245}
104
+ rx={1}
105
+ transform='rotate(-180 12 21.5)'
106
+ stroke='none'
107
+ strokeWidth={1.5}
108
+ />
109
+ <path
110
+ d='M16.5 9.5V11L21 7.25L16.5 3.5V5'
111
+ stroke='none'
112
+ strokeWidth={1.5}
113
+ strokeLinecap='round'
114
+ strokeLinejoin='round'
115
+ />
116
+ </svg>
117
+ )
118
+ break
119
+ default:
120
+ break
121
+ }
122
+ return icon
123
+ }
124
+
125
+ export default DynamicWorkspaceIcon
@@ -0,0 +1,119 @@
1
+ import * as React from 'react'
2
+ import styles from './Icons.module.css'
3
+
4
+ const StaticWorkspaceIcon = ({
5
+ color = 'green',
6
+ size = 'normal',
7
+ tip = ''
8
+ }) => {
9
+ const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
10
+ let icon = (
11
+ <svg
12
+ width={40}
13
+ height={41}
14
+ viewBox='0 0 40 41'
15
+ fill='none'
16
+ xmlns='http://www.w3.org/2000/svg'
17
+ className={className}
18
+ data-tip={tip}
19
+ >
20
+ <rect
21
+ x={5}
22
+ y={5.33325}
23
+ width={10}
24
+ height={12.5874}
25
+ rx={1}
26
+ stroke='none'
27
+ strokeWidth={2.5}
28
+ />
29
+ <rect
30
+ x={20}
31
+ y={5.33325}
32
+ width={15}
33
+ height={12.5874}
34
+ rx={1}
35
+ stroke='none'
36
+ strokeWidth={2.5}
37
+ />
38
+ <rect
39
+ x={35}
40
+ y={35.3333}
41
+ width={10}
42
+ height={12.5874}
43
+ rx={1}
44
+ transform='rotate(-180 35 35.3333)'
45
+ stroke='none'
46
+ strokeWidth={2.5}
47
+ />
48
+ <rect
49
+ x={20}
50
+ y={35.3333}
51
+ width={15}
52
+ height={12.5874}
53
+ rx={1}
54
+ transform='rotate(-180 20 35.3333)'
55
+ stroke='none'
56
+ strokeWidth={2.5}
57
+ />
58
+ </svg>
59
+ )
60
+ switch (size) {
61
+ case 'small':
62
+ icon = (
63
+ <svg
64
+ width={24}
65
+ height={25}
66
+ viewBox='0 0 24 25'
67
+ fill='none'
68
+ xmlns='http://www.w3.org/2000/svg'
69
+ className={className}
70
+ data-tip={tip}
71
+ >
72
+ <rect
73
+ x={3}
74
+ y={3.5}
75
+ width={6}
76
+ height={7.55245}
77
+ rx={1}
78
+ stroke='none'
79
+ strokeWidth={1.5}
80
+ />
81
+ <rect
82
+ x={12}
83
+ y={3.5}
84
+ width={9}
85
+ height={7.55245}
86
+ rx={1}
87
+ stroke='none'
88
+ strokeWidth={1.5}
89
+ />
90
+ <rect
91
+ x={21}
92
+ y={21.5}
93
+ width={6}
94
+ height={7.55245}
95
+ rx={1}
96
+ transform='rotate(-180 21 21.5)'
97
+ stroke='none'
98
+ strokeWidth={1.5}
99
+ />
100
+ <rect
101
+ x={12}
102
+ y={21.5}
103
+ width={9}
104
+ height={7.55245}
105
+ rx={1}
106
+ transform='rotate(-180 12 21.5)'
107
+ stroke='none'
108
+ strokeWidth={1.5}
109
+ />
110
+ </svg>
111
+ )
112
+ break
113
+ default:
114
+ break
115
+ }
116
+ return icon
117
+ }
118
+
119
+ export default StaticWorkspaceIcon
@@ -0,0 +1,48 @@
1
+ import * as React from 'react'
2
+ import styles from './Icons.module.css'
3
+
4
+ const UpgradeIcon = ({ color = 'green', size = 'normal' }) => {
5
+ const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
6
+ let icon = <></>
7
+ switch (size) {
8
+ case 'extra-large':
9
+ icon = (
10
+ <svg
11
+ width={120}
12
+ height={120}
13
+ viewBox='0 0 120 120'
14
+ fill='none'
15
+ xmlns='http://www.w3.org/2000/svg'
16
+ className={className}
17
+ >
18
+ <path
19
+ d='M73.5692 71.2499C70.4961 74.9505 65.8773 77.3043 60.7127 77.3043C55.2863 77.3043 50.4624 74.7057 47.4009 70.6768'
20
+ stroke='none'
21
+ stroke-width={6.5}
22
+ stroke-linecap='round'
23
+ stroke-linejoin='round'
24
+ />
25
+ <path
26
+ d='M23.2957 51.3793L17.6102 51.3793C16.1675 51.3793 15 52.5551 15 54.0082L15 66.8661C15 68.3192 16.1675 69.495 17.6102 69.495L23.2957 69.495C24.3778 69.495 25.3554 70.1738 25.7351 71.1967L28.4782 78.5003C28.8483 79.4946 28.5921 80.6226 27.8138 81.3491L24.074 84.8576C22.973 85.89 22.973 87.649 24.0645 88.691L32.9677 97.161C33.9549 98.1074 35.5115 98.117 36.5176 97.1897L41.4343 92.6775C42.2126 91.97 43.3326 91.7884 44.2913 92.2377L50.8405 95.2968C51.7707 95.727 52.3592 96.6639 52.3592 97.6868L52.3592 102.371C52.3592 103.824 53.5267 105 54.9694 105L65.9608 105C67.4035 105 68.571 103.824 68.571 102.371L68.571 97.4573C68.571 96.3197 69.3018 95.3064 70.3744 94.9527L77.9393 92.4671C78.8315 92.1804 79.8091 92.3907 80.502 93.0216L84.9346 97.0654C86.0167 98.05 87.6967 97.9545 88.6553 96.8455L96.7517 87.5247C97.6819 86.4541 97.5965 84.8289 96.5619 83.8634L93.088 80.613C92.3191 79.9056 92.0534 78.8062 92.3951 77.8216L94.749 71.0342C95.1192 69.973 96.1063 69.2656 97.2168 69.2656L102.39 69.2656C103.833 69.2656 105 68.0898 105 66.6367L105 54.2472C105 52.7941 103.833 51.6183 102.39 51.6183L97.2168 51.6183'
27
+ stroke='none'
28
+ stroke-width={6.5}
29
+ stroke-linecap='round'
30
+ stroke-linejoin='round'
31
+ />
32
+ <path
33
+ d='M59.1684 15.3455L37.5 36.8033L48.75 36.8034L48.75 60.1728L71.25 60.1728L71.25 37.7592L82.5 37.7592L59.1684 15.3455Z'
34
+ stroke='none'
35
+ stroke-width={6.5}
36
+ stroke-linecap='round'
37
+ stroke-linejoin='round'
38
+ />
39
+ </svg>
40
+ )
41
+ break
42
+ default:
43
+ break
44
+ }
45
+ return icon
46
+ }
47
+
48
+ export default UpgradeIcon
@@ -8,12 +8,15 @@ import CircleExclamationIcon from './CircleExclamationIcon'
8
8
  import CircleCloseIcon from './CircleCloseIcon'
9
9
  import CircleCloseHoverIcon from './CircleCloseHoverIcon'
10
10
  import CloseIcon from './CloseIcon'
11
+ import CopyIcon from './CopyIcon'
12
+ import CreatedWorkspaceIcon from './CreatedWorkspaceIcon'
11
13
  import GearIcon from './GearIcon'
12
14
  import MetricsIcon from './MetricsIcon'
13
- import PuzzleDynamicIcon from './PuzzleDynamicIcon'
14
- import PuzzleIcon from './PuzzleIcon'
15
+ import DynamicWorkspaceIcon from './DynamicWorkspaceIcon'
16
+ import StaticWorkspaceIcon from './StaticWorkspaceIcon'
15
17
  import PullRequestIcon from './PullRequestIcon'
16
18
  import TriangleExclamationIcon from './TriangleExclamationIcon'
19
+ import UpgradeIcon from './UpgradeIcon'
17
20
 
18
21
  export default {
19
22
  ApiIcon,
@@ -26,10 +29,13 @@ export default {
26
29
  CircleCloseIcon,
27
30
  CircleCloseHoverIcon,
28
31
  CloseIcon,
32
+ CopyIcon,
33
+ CreatedWorkspaceIcon,
29
34
  GearIcon,
30
35
  MetricsIcon,
31
- PuzzleDynamicIcon,
32
- PuzzleIcon,
36
+ DynamicWorkspaceIcon,
37
+ StaticWorkspaceIcon,
33
38
  PullRequestIcon,
34
- TriangleExclamationIcon
39
+ TriangleExclamationIcon,
40
+ UpgradeIcon
35
41
  }
@@ -40,11 +40,15 @@ export default {
40
40
  options: ['small', 'medium', 'large', 'extra-large']
41
41
  }
42
42
  },
43
- underlineEffect: {
44
- type: 'boolean'
43
+ hoverEffect: {
44
+ type: 'radio',
45
+ options: ['hover', 'underline']
45
46
  },
46
47
  bordered: {
47
48
  type: 'boolean'
49
+ },
50
+ fullWidth: {
51
+ type: 'boolean'
48
52
  }
49
53
  }
50
54
  }
@@ -55,7 +59,7 @@ export const OnlyLabel = Template.bind({})
55
59
  // More on args: https://storybook.js.org/docs/react/writing-stories/args
56
60
  OnlyLabel.args = {
57
61
  label: 'Sample label',
58
- backgroundColor: 'light-green'
62
+ backgroundColor: 'main-green'
59
63
  }
60
64
 
61
65
  export const BorderedRed = Template.bind({})
@@ -0,0 +1,46 @@
1
+ import React from 'react'
2
+ import InfoBox from '../components/InfoBox'
3
+
4
+ const divStyle = {
5
+ width: '100%',
6
+ height: 'auto',
7
+ padding: '10px',
8
+ backgroundColor: 'white'
9
+ }
10
+
11
+ export default {
12
+ title: 'Platformatic/InfoBox',
13
+ component: InfoBox,
14
+ decorators: [
15
+ (Story) => (
16
+ <div style={divStyle}>
17
+ <Story />
18
+ </div>
19
+ )
20
+ ]
21
+ }
22
+
23
+ const Template = (args) => <InfoBox {...args}><p>this will be your custom title</p></InfoBox>
24
+ export const InfoBoxSample = Template.bind({})
25
+ InfoBoxSample.args = {
26
+ iconLogo: 'UpgradeIcon',
27
+ helpText: 'Helper text',
28
+ buttonProps: {
29
+ label: 'Sample button',
30
+ backgroundColor: 'main-green',
31
+ color: 'red',
32
+ onClick: () => alert('Clicked InfoBoxSample')
33
+ }
34
+ }
35
+
36
+ const ContainedTemplate = (args) => <div style={{ maxWidth: '300px' }}><InfoBox {...args} /></div>
37
+ export const InfoBoxContained = ContainedTemplate.bind({})
38
+ InfoBoxContained.args = {
39
+ iconLogo: 'UpgradeIcon',
40
+ helpText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.',
41
+ buttonProps: {
42
+ label: 'Sample button',
43
+ color: 'white',
44
+ onClick: () => alert('Clicked ContainedTemplate')
45
+ }
46
+ }
@@ -36,9 +36,9 @@ EmptySidebar.args = {
36
36
 
37
37
  const FullSidebarTemplate = (args) => {
38
38
  const [items, setItems] = useState([
39
- { iconName: 'PuzzleIcon', subTitle: 'Subtitle', title: 'a very very very very very long title 1' },
39
+ { iconName: 'StaticWorkspaceIcon', subTitle: 'Subtitle', title: 'a very very very very very long title 1' },
40
40
  { title: 'Title number 2', subTitle: 'Subtitle 2' },
41
- { title: 'Another Title', subTitle: 'Subtitle 3', iconName: 'PuzzleDynamicIcon' }
41
+ { title: 'Another Title', subTitle: 'Subtitle 3', iconName: 'DynamicWorkspaceIcon' }
42
42
  ])
43
43
  function onClickAdd () {
44
44
  const tmpItem = items.map(item => item)
@@ -11,26 +11,47 @@ const divStyle = {
11
11
  export default {
12
12
  title: 'Platformatic/Forms/Preview',
13
13
  component: Preview,
14
- parameters: {
15
- backgrounds: {
16
- default: 'white'
17
- }
18
- }
14
+ decorators: [
15
+ (Story) => (
16
+ <div style={divStyle}>
17
+ <Story />
18
+ </div>
19
+ )
20
+ ]
19
21
  }
20
22
 
21
- const SimpleTemplate = (args) => <div style={divStyle}><Preview {...args} /></div>
23
+ const Template = (args) => <Preview {...args} />
22
24
 
23
- export const NormalPreview = SimpleTemplate.bind({})
25
+ export const NormalPreview = Template.bind({})
24
26
 
25
27
  NormalPreview.args = {
26
28
  title: 'My title',
27
29
  value: 'My value'
28
30
  }
29
31
 
30
- export const WithLink = SimpleTemplate.bind({})
32
+ export const WithLink = Template.bind({})
31
33
 
32
34
  WithLink.args = {
33
35
  title: 'My value is a link',
34
36
  value: 'https://example.com',
35
37
  isLink: true
36
38
  }
39
+
40
+ const TemplateWithChildren = (args) => <Preview {...args}><p>1st paragraph</p><p>2nd paragraph</p></Preview>
41
+
42
+ export const WithChildren = TemplateWithChildren.bind({})
43
+
44
+ WithChildren.args = {
45
+ title: 'My title',
46
+ value: 'My value'
47
+ }
48
+
49
+ export const WithIcon = Template.bind({})
50
+
51
+ WithIcon.args = {
52
+ title: 'My title',
53
+ value: 'My value',
54
+ afterValueIcon: 'StaticWorkspaceIcon',
55
+ afterValueIconColor: 'green',
56
+ onClickAfterValueIcon: () => alert('icon clicked')
57
+ }
@@ -3,10 +3,29 @@ import PullRequestIcon from '../../components/icons/PullRequestIcon'
3
3
  import CloseIcon from '../../components/icons/CloseIcon'
4
4
  import CircleCloseIcon from '../../components/icons/CircleCloseIcon'
5
5
  import TriangleExclamationIcon from '../../components/icons/TriangleExclamationIcon'
6
+ import StaticWorkspaceIcon from '../../components/icons/StaticWorkspaceIcon'
7
+ import CreatedWorkspaceIcon from '../../components/icons/CreatedWorkspaceIcon'
8
+ import UpgradeIcon from '../../components/icons/UpgradeIcon'
9
+ import DynamicWorkspaceIcon from '../../components/icons/DynamicWorkspaceIcon'
10
+
11
+ const divStyle = {
12
+ display: 'flex',
13
+ width: '100%',
14
+ minHeight: '400px',
15
+ gap: '10px',
16
+ backgroundColor: 'white'
17
+ }
6
18
 
7
19
  export default {
8
20
  title: 'Platformatic/Icons',
9
21
  component: PullRequestIcon,
22
+ decorators: [
23
+ (Story) => (
24
+ <div style={divStyle}>
25
+ <Story />
26
+ </div>
27
+ )
28
+ ],
10
29
  argTypes: {
11
30
  color: {
12
31
  type: 'string',
@@ -33,3 +52,23 @@ CircleCloseIconDefault.args = {}
33
52
  const TriangleExclamationIconTemplate = (args) => <TriangleExclamationIcon {...args} />
34
53
  export const TriangleExclamationIconDefault = TriangleExclamationIconTemplate.bind({})
35
54
  TriangleExclamationIconDefault.args = {}
55
+
56
+ const WorkspaceIconsTemplate = () => (
57
+ [<StaticWorkspaceIcon key='a' />, <DynamicWorkspaceIcon key='b' />].map((component, index) => {
58
+ const listElement = []
59
+ listElement.push(React.cloneElement(component, { key: `0${index}` }))
60
+ listElement.push(React.cloneElement(component, { key: `1${index}`, size: 'small', color: 'green' }))
61
+ listElement.push(React.cloneElement(component, { key: `2${index}`, color: 'red' }))
62
+ listElement.push(React.cloneElement(component, { key: `3${index}`, size: 'small', color: 'red' }))
63
+ listElement.push(React.cloneElement(component, { key: `4${index}`, color: 'main-dark-blue' }))
64
+ listElement.push(React.cloneElement(component, { key: `5${index}`, size: 'small', color: 'main-dark-blue' }))
65
+ return listElement
66
+ })
67
+ )
68
+
69
+ export const WorkspaceIconsAll = WorkspaceIconsTemplate.bind({})
70
+ WorkspaceIconsAll.args = {}
71
+
72
+ const LargeIconsTemplate = () => ([<CreatedWorkspaceIcon key='a' size='extra-large' />, <UpgradeIcon key='b' size='extra-large' />].map(component => component))
73
+ export const LargeIconsDefault = LargeIconsTemplate.bind({})
74
+ LargeIconsDefault.args = {}
@@ -11,7 +11,15 @@ module.exports = {
11
11
  // => @media (min-width: 1440px) { ... }
12
12
  },
13
13
  boxShadow: {
14
- wrap: '0px 0px 20px rgba(0, 0, 0, 0.6)'
14
+ wrap: '0px 0px 20px rgba(0, 0, 0, 0.6)',
15
+ 'main-green': '0px 0px 10px rgba(33, 250, 144, 0.5)',
16
+ 'dark-green': '0px 0px 10px rgba(2, 120, 63, 1)',
17
+ 'light-green': '0px 0px 10px rgba(33, 241, 144, 0.5)',
18
+ 'main-dark-blue': '0px 0px 10px rgba(33, 250, 144, 0.5)',
19
+ 'dark-blue': '0px 0px 10px rgba(0, 52, 79, 0.5)',
20
+ 'light-blue': '0px 0px 10px rgba(233, 247, 255, 0.5)',
21
+ 'error-red': '0px 0px 10px rgba(250, 33, 33, 0.5)',
22
+ 'tertiary-blue': '0px 0px 10px rgba(37, 136, 228, 0.5)'
15
23
  }
16
24
  },
17
25
  colors: {
@@ -1,69 +0,0 @@
1
- import * as React from 'react'
2
- import styles from './Icons.module.css'
3
- const PuzzleDynamicIcon = ({ color = 'green', size = 'normal' }) => {
4
- const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
5
- let dimension = 33
6
- switch (size) {
7
- case 'small':
8
- dimension = 24
9
- break
10
- default:
11
- break
12
- }
13
- return (
14
- <svg
15
- width={dimension}
16
- height={dimension}
17
- viewBox='0 0 32 33'
18
- fill='none'
19
- xmlns='http://www.w3.org/2000/svg'
20
- className={className}
21
- >
22
- <rect
23
- x={4}
24
- y={4.83325}
25
- width={8}
26
- height={10.0699}
27
- rx={1}
28
- stroke='none'
29
- strokeWidth={1.5}
30
- />
31
- <path
32
- d='M16 4.83325L22 9.83325L16 14.8333V4.83325Z'
33
- stroke='none'
34
- strokeWidth={2}
35
- strokeLinecap='round'
36
- strokeLinejoin='round'
37
- />
38
- <rect
39
- x={28}
40
- y={28.8333}
41
- width={8}
42
- height={10.0699}
43
- rx={1}
44
- transform='rotate(-180 28 28.8333)'
45
- stroke='none'
46
- strokeWidth={1.5}
47
- />
48
- <rect
49
- x={16}
50
- y={28.8333}
51
- width={12}
52
- height={10.0699}
53
- rx={1}
54
- transform='rotate(-180 16 28.8333)'
55
- stroke='none'
56
- strokeWidth={1.5}
57
- />
58
- <path
59
- d='M22 12.8333V14.8333L28 9.83325L22 4.83325V6.83325'
60
- stroke='none'
61
- strokeWidth={1.5}
62
- strokeLinecap='round'
63
- strokeLinejoin='round'
64
- />
65
- </svg>
66
- )
67
- }
68
-
69
- export default PuzzleDynamicIcon
@@ -1,65 +0,0 @@
1
- import * as React from 'react'
2
- import styles from './Icons.module.css'
3
- const PuzzleIcon = ({ color = 'green', size = 'normal', tip = '' }) => {
4
- const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
5
- let dimension = 33
6
- switch (size) {
7
- case 'small':
8
- dimension = 24
9
- break
10
- default:
11
- break
12
- }
13
- return (
14
- <svg
15
- width={dimension}
16
- height={dimension}
17
- viewBox='0 0 33 32'
18
- fill='none'
19
- xmlns='http://www.w3.org/2000/svg'
20
- className={className}
21
- data-tip={tip}
22
- >
23
- <rect
24
- x={4.5}
25
- y={4}
26
- width={8}
27
- height={10.0699}
28
- rx={1}
29
- stroke='none'
30
- strokeWidth={1.5}
31
- />
32
- <rect
33
- x={16.5}
34
- y={4}
35
- width={12}
36
- height={10.0699}
37
- rx={1}
38
- stroke='none'
39
- strokeWidth={1.5}
40
- />
41
- <rect
42
- x={28.5}
43
- y={28}
44
- width={8}
45
- height={10.0699}
46
- rx={1}
47
- transform='rotate(-180 28.5 28)'
48
- stroke='none'
49
- strokeWidth={1.5}
50
- />
51
- <rect
52
- x={16.5}
53
- y={28}
54
- width={12}
55
- height={10.0699}
56
- rx={1}
57
- transform='rotate(-180 16.5 28)'
58
- stroke='none'
59
- strokeWidth={1.5}
60
- />
61
- </svg>
62
- )
63
- }
64
-
65
- export default PuzzleIcon