@platformatic/ui-components 0.1.45 → 0.1.47

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/index.js CHANGED
@@ -13,6 +13,7 @@ import GHLoginButton from './src/components/GHLoginButton'
13
13
  import HorizontalSeparator from './src/components/HorizontalSeparator'
14
14
  import Forms from './src/components/forms'
15
15
  import Icons from './src/components/icons'
16
+ import InfoBox from './src/components/InfoBox'
16
17
  import Sidebar from './src/components/Sidebar'
17
18
  import Layout from './src/components/layouts/Layout'
18
19
  import List from './src/components/List'
@@ -22,6 +23,7 @@ import Loader from './src/components/Loader'
22
23
  import LoginButton from './src/components/LoginButton'
23
24
  import Logo from './src/components/Logo'
24
25
  import Modal from './src/components/Modal'
26
+ import PlatformaticIcon from './src/components/PlatformaticIcon'
25
27
  import Playground from './src/components/Playground'
26
28
  import SearchBar from './src/components/SearchBar'
27
29
  import SimpleMetric from './src/components/SimpleMetric'
@@ -46,6 +48,7 @@ export {
46
48
  GHLoginButton,
47
49
  Forms,
48
50
  Icons,
51
+ InfoBox,
49
52
  Sidebar,
50
53
  Layout,
51
54
  List,
@@ -55,6 +58,7 @@ export {
55
58
  LoginButton,
56
59
  Logo,
57
60
  Modal,
61
+ PlatformaticIcon,
58
62
  Playground,
59
63
  SearchBar,
60
64
  SimpleMetric,
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.45",
4
+ "version": "0.1.47",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -5,7 +5,7 @@ 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, hoverEffect, 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) {
@@ -18,7 +18,7 @@ function Button (props) {
18
18
  }
19
19
  }
20
20
  if (bold) className += ` ${styles.fontBold}`
21
-
21
+ if (fullWidth) className += ` ${styles.fullWidth}`
22
22
  return (
23
23
  <button className={className} disabled={disabled} alt={label} {...rest}>
24
24
  {icon ? <FontAwesomeIcon icon={icon} className={`${styles['margin-right-' + size]}`} data-testid='button-icon' /> : null}
@@ -63,7 +63,11 @@ Button.propTypes = {
63
63
  /**
64
64
  * Apply border: default true
65
65
  */
66
- bordered: PropTypes.bool
66
+ bordered: PropTypes.bool,
67
+ /**
68
+ * Full Width: default false
69
+ */
70
+ fullWidth: PropTypes.bool
67
71
  }
68
72
 
69
73
  Button.defaultProps = {
@@ -73,7 +77,8 @@ Button.defaultProps = {
73
77
  size: 'large',
74
78
  bold: false,
75
79
  hoverEffect: 'hover',
76
- bordered: true
80
+ bordered: true,
81
+ fullWidth: false
77
82
  }
78
83
 
79
84
  export default Button
@@ -122,4 +122,7 @@
122
122
  }
123
123
  .underline-effect {
124
124
  @apply hover:underline;
125
+ }
126
+ .fullWidth {
127
+ @apply w-full;
125
128
  }
@@ -0,0 +1,50 @@
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 PlatformaticIcon from './PlatformaticIcon'
7
+
8
+ function InfoBox ({ children, iconLogo, helpText, buttonProps }) {
9
+ return (
10
+ <div className={styles.container}>
11
+ <PlatformaticIcon size='extra-large' iconName={iconLogo} />
12
+ {children}
13
+ <p className={styles.helpText}>{helpText}</p>
14
+ {buttonProps && (<Button type='button' size='extra-large' label={buttonProps.label} color={buttonProps.color} backgroundColor={buttonProps.backgroundColor} onClick={() => buttonProps.onClick()} fullWidth bold />)}
15
+ </div>
16
+ )
17
+ }
18
+
19
+ InfoBox.propTypes = {
20
+ /**
21
+ * children
22
+ */
23
+ children: PropTypes.node,
24
+ /**
25
+ * iconLogo
26
+ */
27
+ iconLogo: PropTypes.string,
28
+ /**
29
+ * helpText
30
+ */
31
+ helpText: PropTypes.string,
32
+ /**
33
+ * background color of the button
34
+ */
35
+ buttonProps: PropTypes.shape({
36
+ label: PropTypes.string,
37
+ backgroundColor: PropTypes.string,
38
+ color: PropTypes.string,
39
+ onClick: PropTypes.func
40
+ })
41
+ }
42
+
43
+ InfoBox.defaultProps = {
44
+ children: null,
45
+ iconLogo: null,
46
+ helpText: null,
47
+ buttonProps: null
48
+ }
49
+
50
+ export default InfoBox
@@ -0,0 +1,6 @@
1
+ .container {
2
+ @apply bg-main-dark-blue border-0 rounded-md p-4 flex flex-col items-center gap-y-4 w-full;
3
+ }
4
+ .helpText {
5
+ @apply text-sm text-center mx-6 text-white font-normal;
6
+ }
@@ -47,6 +47,9 @@
47
47
  .maxW70 {
48
48
  @apply max-w-[70%];
49
49
  }
50
+ .maxW100 {
51
+ @apply max-w-[100%];
52
+ }
50
53
  .titleFullscreen {
51
54
  @apply inline-flex items-center;
52
55
  }
@@ -0,0 +1,57 @@
1
+ 'use strict'
2
+ import React from 'react'
3
+ import PropTypes from 'prop-types'
4
+ import Icons from './icons'
5
+ import styles from './PlatformaticIcon.module.css'
6
+
7
+ function PlatformaticIcon ({ iconName, color, onClick, size, classes, tip }) {
8
+ let icon = React.createElement(Icons[`${iconName}`], {
9
+ color,
10
+ size,
11
+ tip
12
+ })
13
+ if (onClick) {
14
+ let className = styles.cursorPointer
15
+ if (classes) className += ` ${classes}`
16
+ icon = (<span className={className} onClick={onClick}>{icon}</span>)
17
+ }
18
+ return icon
19
+ }
20
+
21
+ PlatformaticIcon.propTypes = {
22
+ /**
23
+ * iconName
24
+ */
25
+ iconName: PropTypes.string.isRequired,
26
+ /**
27
+ * color
28
+ */
29
+ color: PropTypes.string,
30
+ /**
31
+ * size
32
+ */
33
+ size: PropTypes.string,
34
+ /**
35
+ * onClick
36
+ */
37
+ onClick: PropTypes.func,
38
+ /**
39
+ * classes
40
+ */
41
+ classes: PropTypes.string,
42
+ /**
43
+ * tip
44
+ */
45
+ tip: PropTypes.string
46
+ }
47
+
48
+ PlatformaticIcon.defaultProps = {
49
+ iconName: null,
50
+ color: 'green',
51
+ size: 'small',
52
+ onClick: () => {},
53
+ classes: null,
54
+ tip: null
55
+ }
56
+
57
+ export default PlatformaticIcon
@@ -0,0 +1,3 @@
1
+ .cursorPointer {
2
+ @apply cursor-pointer;
3
+ }
@@ -1,10 +1,9 @@
1
1
  import React, { useState } from 'react'
2
2
  import Icons from './icons'
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
4
- import { faChevronLeft, faPlusCircle } from '@fortawesome/free-solid-svg-icons'
5
3
  import styles from './Sidebar.module.css'
6
4
  import ReactTooltip from 'react-tooltip'
7
5
  import HorizontalSeparator from './HorizontalSeparator'
6
+ import PlatformaticIcon from './PlatformaticIcon'
8
7
  import PropTypes from 'prop-types'
9
8
 
10
9
  function Sidebar (props) {
@@ -25,17 +24,6 @@ function Sidebar (props) {
25
24
  onClickItemSelectedParent(index)
26
25
  }
27
26
 
28
- function renderItemIcon (iconName, title, isSelected) {
29
- if (iconName) {
30
- return React.createElement(Icons[`${iconName}`], {
31
- size: 'small',
32
- color: isSelected ? 'green' : 'white',
33
- tip: title
34
- })
35
- }
36
- return (<></>)
37
- }
38
-
39
27
  return (
40
28
  <div className={`${styles.container} ${collapsed && styles.collapsed}`}>
41
29
  {collapsed
@@ -61,7 +49,11 @@ function Sidebar (props) {
61
49
  : (
62
50
  <>
63
51
  <button type='button' className={styles.buttonCollapse} onClick={() => { setCollapsed(true) }}>
64
- <FontAwesomeIcon icon={faChevronLeft} size='1x' color='white' />
52
+ <PlatformaticIcon
53
+ iconName='CircleBackIcon'
54
+ color='white'
55
+ size='normal'
56
+ />
65
57
  </button>
66
58
  <div className={styles.title} data-testid='lateral-bar-title'>
67
59
  {title}
@@ -72,7 +64,11 @@ function Sidebar (props) {
72
64
  return (
73
65
  <React.Fragment key={index}>
74
66
  <button className={`${styles.buttonItem} ${collapsed && styles.buttonItemCollapsed}`} type='button' onClick={() => onClickItemSelected(index)}>
75
- {renderItemIcon(item.iconName, item.title, isSelected)}
67
+ {item.iconName && (<PlatformaticIcon
68
+ iconName={item.iconName}
69
+ color={isSelected ? 'green' : 'white'}
70
+ tip={item.title}
71
+ />)}
76
72
  <div className={`${styles.item} ${isSelected ? styles.itemSelected : ''}`}>
77
73
  <span className={styles.itemSubTitle}>{item.subTitle}</span>
78
74
  <span className={styles.itemTitle}>{item.title}</span>
@@ -84,7 +80,11 @@ function Sidebar (props) {
84
80
  })}
85
81
  {/* <Button label='Add' buttonClass='transparent' icon={faPlus} color='white' size='small' inClick={onClickAdd}/> */}
86
82
  <button className={`${styles.buttonItem} ${collapsed && styles.buttonItemCollapsed}`} onClick={onClickAdd}>
87
- <FontAwesomeIcon color='white' icon={faPlusCircle} data-tip={addTitle} />
83
+ <PlatformaticIcon
84
+ iconName='CircleAddIcon'
85
+ color='white'
86
+ tip={addTitle}
87
+ />
88
88
  {!collapsed && <span className={styles.item}>{addTitle}</span>}
89
89
  </button>
90
90
  </div>
@@ -1,5 +1,5 @@
1
1
  .container {
2
- @apply max-w-[216px] w-full p-4 border border-white rounded-md h-auto relative;
2
+ @apply max-w-[216px] w-full p-4 border border-white rounded-md h-auto relative min-h-[80vh];
3
3
  transition: max-width 0.2s linear;
4
4
  }
5
5
  .collapsed {
@@ -12,7 +12,7 @@
12
12
  @apply border rounded-md p-1 border-white;
13
13
  }
14
14
  .buttonCollapse {
15
- @apply absolute border border-white rounded-full h-6 w-6 right-[-0.875rem];
15
+ @apply absolute border-0 rounded-full right-[-0.875rem];
16
16
  /* Override tailwind dist button[type='button]: background: transparent*/
17
17
  @apply bg-main-dark-blue !important;
18
18
  top: 1rem;
@@ -1,15 +1,77 @@
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 PlatformaticIcon from '../PlatformaticIcon'
4
6
 
5
- export default function Preview ({ title, value, isLink = false }) {
7
+ function renderLink (value) {
8
+ return (<a className={styles.link} href={value} target='_blank' rel='noreferrer'>{value}</a>)
9
+ }
10
+
11
+ function renderParagraph (value, afterValueIcon, afterValueIconColor, onClickAfterValueIcon) {
12
+ return (
13
+ <>
14
+ <p className={styles.value}>
15
+ {value}
16
+ {afterValueIcon && (<PlatformaticIcon iconName={afterValueIcon} color={afterValueIconColor} classes={styles.afterIcon} onClick={() => onClickAfterValueIcon} />)}
17
+ </p>
18
+ </>
19
+ )
20
+ }
21
+ function Preview ({ title, value, isLink, children, afterValueIcon, afterValueIconColor, onClickAfterValueIcon }) {
6
22
  return (
7
23
  <>
8
24
  <div className={styles.container}>
9
25
  <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>}
26
+ {isLink ? renderLink(value) : renderParagraph(value, afterValueIcon, afterValueIconColor, onClickAfterValueIcon)}
11
27
  </div>
28
+ {children}
12
29
  <HorizontalSeparator color='main-dark-green' opacity={20} marginBottom={10} marginTop={10} />
13
30
  </>
14
31
  )
15
32
  }
33
+
34
+ Preview.propTypes = {
35
+ /**
36
+ * title
37
+ */
38
+ title: PropTypes.string,
39
+ /**
40
+ * value
41
+ */
42
+ value: PropTypes.oneOfType([
43
+ PropTypes.string,
44
+ PropTypes.number
45
+ ]),
46
+ /**
47
+ * isLink
48
+ */
49
+ isLink: PropTypes.bool,
50
+ /**
51
+ * color of border
52
+ */
53
+ children: PropTypes.node,
54
+ /**
55
+ * afterValueIcon
56
+ */
57
+ afterValueIcon: PropTypes.string,
58
+ /**
59
+ * afterValueIconColor
60
+ */
61
+ afterValueIconColor: PropTypes.oneOf(['error-red', 'main-dark-blue', 'white']),
62
+ /**
63
+ * onClickAfterValueIcon
64
+ */
65
+ onClickAfterValueIcon: PropTypes.func
66
+ }
67
+
68
+ Preview.defaultProps = {
69
+ title: '',
70
+ value: '',
71
+ isLink: false,
72
+ afterValueIconColor: 'main-dark-blue',
73
+ afterValueIcon: null,
74
+ onClickAfterValueIcon: () => {}
75
+ }
76
+
77
+ 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;
15
+ }
@@ -0,0 +1,40 @@
1
+ import * as React from 'react'
2
+ import styles from './Icons.module.css'
3
+
4
+ const CircleAddIcon = ({ 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={18}
12
+ height={18}
13
+ viewBox='0 0 18 18'
14
+ fill='none'
15
+ xmlns='http://www.w3.org/2000/svg'
16
+ className={className}
17
+ >
18
+ <circle cx={9} cy={9} r={8} stroke='none' />
19
+ <path
20
+ d='M4 9H14'
21
+ stroke='none'
22
+ strokeLinecap='round'
23
+ strokeLinejoin='round'
24
+ />
25
+ <path
26
+ d='M9 14L9 4.00002'
27
+ stroke='none'
28
+ strokeLinecap='round'
29
+ strokeLinejoin='round'
30
+ />
31
+ </svg>
32
+ )
33
+ break
34
+ default:
35
+ break
36
+ }
37
+ return icon
38
+ }
39
+
40
+ export default CircleAddIcon
@@ -0,0 +1,51 @@
1
+ import * as React from 'react'
2
+ import styles from './Icons.module.css'
3
+
4
+ const CircleBackIcon = ({ color = 'green', size = 'normal' }) => {
5
+ const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
6
+ let icon = (
7
+ <svg
8
+ width={26}
9
+ height={26}
10
+ viewBox='0 0 26 26'
11
+ fill='none'
12
+ xmlns='http://www.w3.org/2000/svg'
13
+ className={className}
14
+ >
15
+ <circle cx={13} cy={13} r={12} fill='none' stroke='none' />
16
+ <path
17
+ d='M14.5 7L8.5 13L14.5 19'
18
+ stroke='none'
19
+ strokeLinecap='round'
20
+ strokeLinejoin='round'
21
+ />
22
+ </svg>
23
+ )
24
+ switch (size) {
25
+ case 'small':
26
+ icon = (
27
+ <svg
28
+ width={18}
29
+ height={18}
30
+ viewBox='0 0 18 18'
31
+ fill='none'
32
+ xmlns='http://www.w3.org/2000/svg'
33
+ className={className}
34
+ >
35
+ <circle cx={9} cy={9} r={8} stroke='none' />
36
+ <path
37
+ d='M10 5L6 9L10 13'
38
+ stroke='none'
39
+ strokeLinecap='round'
40
+ strokeLinejoin='round'
41
+ />
42
+ </svg>
43
+ )
44
+ break
45
+ default:
46
+ break
47
+ }
48
+ return icon
49
+ }
50
+
51
+ export default CircleBackIcon
@@ -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,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
+ strokeWidth={6.5}
22
+ strokeLinecap='round'
23
+ strokeLinejoin='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
+ strokeWidth={6.5}
29
+ strokeLinecap='round'
30
+ strokeLinejoin='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
+ strokeWidth={6.5}
36
+ strokeLinecap='round'
37
+ strokeLinejoin='round'
38
+ />
39
+ </svg>
40
+ )
41
+ break
42
+ default:
43
+ break
44
+ }
45
+ return icon
46
+ }
47
+
48
+ export default UpgradeIcon
@@ -4,16 +4,21 @@ import ApiEmptyIcon from './ApiEmptyIcon'
4
4
  import AppIcon from './AppIcon'
5
5
  import AppListIcon from './AppListIcon'
6
6
  import AppEmptyIcon from './AppEmptyIcon'
7
+ import CircleAddIcon from './CircleAddIcon'
8
+ import CircleBackIcon from './CircleBackIcon'
7
9
  import CircleExclamationIcon from './CircleExclamationIcon'
8
10
  import CircleCloseIcon from './CircleCloseIcon'
9
11
  import CircleCloseHoverIcon from './CircleCloseHoverIcon'
10
12
  import CloseIcon from './CloseIcon'
13
+ import CopyIcon from './CopyIcon'
14
+ import CreatedWorkspaceIcon from './CreatedWorkspaceIcon'
11
15
  import GearIcon from './GearIcon'
12
16
  import MetricsIcon from './MetricsIcon'
13
17
  import DynamicWorkspaceIcon from './DynamicWorkspaceIcon'
14
18
  import StaticWorkspaceIcon from './StaticWorkspaceIcon'
15
19
  import PullRequestIcon from './PullRequestIcon'
16
20
  import TriangleExclamationIcon from './TriangleExclamationIcon'
21
+ import UpgradeIcon from './UpgradeIcon'
17
22
 
18
23
  export default {
19
24
  ApiIcon,
@@ -22,14 +27,19 @@ export default {
22
27
  AppIcon,
23
28
  AppListIcon,
24
29
  AppEmptyIcon,
30
+ CircleAddIcon,
31
+ CircleBackIcon,
25
32
  CircleExclamationIcon,
26
33
  CircleCloseIcon,
27
34
  CircleCloseHoverIcon,
28
35
  CloseIcon,
36
+ CopyIcon,
37
+ CreatedWorkspaceIcon,
29
38
  GearIcon,
30
39
  MetricsIcon,
31
40
  DynamicWorkspaceIcon,
32
41
  StaticWorkspaceIcon,
33
42
  PullRequestIcon,
34
- TriangleExclamationIcon
43
+ TriangleExclamationIcon,
44
+ UpgradeIcon
35
45
  }
@@ -46,6 +46,9 @@ export default {
46
46
  },
47
47
  bordered: {
48
48
  type: 'boolean'
49
+ },
50
+ fullWidth: {
51
+ type: 'boolean'
49
52
  }
50
53
  }
51
54
  }
@@ -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
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import PlatformaticIcon from '../components/PlatformaticIcon'
3
+
4
+ export default {
5
+ title: 'Platformatic/PlatformaticIcon',
6
+ component: PlatformaticIcon
7
+ }
8
+
9
+ const Template = (args) => <PlatformaticIcon {...args} />
10
+ export const PlatformaticIconDefault = Template.bind({})
11
+ PlatformaticIconDefault.args = {
12
+ iconName: 'CopyIcon',
13
+ onClick: () => alert('clicked')
14
+ }
@@ -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
+ }
@@ -4,11 +4,28 @@ import CloseIcon from '../../components/icons/CloseIcon'
4
4
  import CircleCloseIcon from '../../components/icons/CircleCloseIcon'
5
5
  import TriangleExclamationIcon from '../../components/icons/TriangleExclamationIcon'
6
6
  import StaticWorkspaceIcon from '../../components/icons/StaticWorkspaceIcon'
7
+ import CreatedWorkspaceIcon from '../../components/icons/CreatedWorkspaceIcon'
8
+ import UpgradeIcon from '../../components/icons/UpgradeIcon'
7
9
  import DynamicWorkspaceIcon from '../../components/icons/DynamicWorkspaceIcon'
8
10
 
11
+ const divStyle = {
12
+ display: 'flex',
13
+ width: '100%',
14
+ minHeight: '400px',
15
+ gap: '10px',
16
+ backgroundColor: 'white'
17
+ }
18
+
9
19
  export default {
10
20
  title: 'Platformatic/Icons',
11
21
  component: PullRequestIcon,
22
+ decorators: [
23
+ (Story) => (
24
+ <div style={divStyle}>
25
+ <Story />
26
+ </div>
27
+ )
28
+ ],
12
29
  argTypes: {
13
30
  color: {
14
31
  type: 'string',
@@ -36,29 +53,22 @@ const TriangleExclamationIconTemplate = (args) => <TriangleExclamationIcon {...a
36
53
  export const TriangleExclamationIconDefault = TriangleExclamationIconTemplate.bind({})
37
54
  TriangleExclamationIconDefault.args = {}
38
55
 
39
- const divStyle = {
40
- display: 'flex',
41
- width: '100%',
42
- minHeight: '400px',
43
- gap: '10px',
44
- backgroundColor: 'white'
45
- }
46
-
47
56
  const WorkspaceIconsTemplate = () => (
48
- <div style={divStyle}>
49
- {
50
- [<StaticWorkspaceIcon key='a' />, <DynamicWorkspaceIcon key='b' />].map((component, index) => {
51
- const listElement = []
52
- listElement.push(React.cloneElement(component, { key: `0${index}` }))
53
- listElement.push(React.cloneElement(component, { key: `1${index}`, size: 'small', color: 'green' }))
54
- listElement.push(React.cloneElement(component, { key: `2${index}`, color: 'red' }))
55
- listElement.push(React.cloneElement(component, { key: `3${index}`, size: 'small', color: 'red' }))
56
- listElement.push(React.cloneElement(component, { key: `4${index}`, color: 'main-dark-blue' }))
57
- listElement.push(React.cloneElement(component, { key: `5${index}`, size: 'small', color: 'main-dark-blue' }))
58
- return listElement
59
- })
60
- }
61
- </div>)
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
+ )
62
68
 
63
69
  export const WorkspaceIconsAll = WorkspaceIconsTemplate.bind({})
64
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 = {}