@platformatic/ui-components 0.1.46 → 0.1.48

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.46",
4
+ "version": "0.1.48",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -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;
@@ -3,25 +3,15 @@ import React from 'react'
3
3
  import PropTypes from 'prop-types'
4
4
  import styles from './InfoBox.module.css'
5
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
- }
6
+ import PlatformaticIcon from './PlatformaticIcon'
17
7
 
18
8
  function InfoBox ({ children, iconLogo, helpText, buttonProps }) {
19
9
  return (
20
10
  <div className={styles.container}>
21
- {renderItemIcon(iconLogo)}
11
+ <PlatformaticIcon size='extra-large' iconName={iconLogo} />
22
12
  {children}
23
13
  <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 />)}
14
+ {buttonProps && (<Button type='button' size='extra-large' label={buttonProps.label} color={buttonProps.color} backgroundColor={buttonProps.backgroundColor} onClick={() => buttonProps.onClick()} fullWidth bold />)}
25
15
  </div>
26
16
  )
27
17
  }
@@ -1,5 +1,5 @@
1
1
  .container {
2
- @apply bg-main-dark-blue border-0 rounded-md p-3 flex flex-col items-center gap-y-2 w-full;
2
+ @apply bg-main-dark-blue border-0 rounded-md p-4 flex flex-col items-center gap-y-4 w-full;
3
3
  }
4
4
  .helpText {
5
5
  @apply text-sm text-center mx-6 text-white font-normal;
@@ -2,7 +2,7 @@
2
2
  @apply flex justify-center items-center gap-x-2;
3
3
  }
4
4
  .value {
5
- @apply text-[32px] font-semibold;
5
+ @apply text-sm lg:text-base;
6
6
  }
7
7
  .unit,
8
8
  .pre {
@@ -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', maxWidth = 50 } = props
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={classNameFullScreen}>
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,12 +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
44
  .titleFullscreen {
51
45
  @apply inline-flex items-center;
52
46
  }
@@ -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;
@@ -2,38 +2,28 @@ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import styles from './Preview.module.css'
4
4
  import HorizontalSeparator from '../HorizontalSeparator'
5
- import Icons from '../icons'
6
-
7
- function renderItemIcon (iconName, color) {
8
- if (iconName) {
9
- return React.createElement(Icons[`${iconName}`], {
10
- color,
11
- size: 'small'
12
- })
13
- }
14
- return (<></>)
15
- }
5
+ import PlatformaticIcon from '../PlatformaticIcon'
16
6
 
17
7
  function renderLink (value) {
18
8
  return (<a className={styles.link} href={value} target='_blank' rel='noreferrer'>{value}</a>)
19
9
  }
20
10
 
21
- function renderParagraph (value, afterValueIcon, afterValueColor, onClickAfterValueIcon) {
11
+ function renderParagraph (value, afterValueIcon, afterValueIconColor, onClickAfterValueIcon) {
22
12
  return (
23
13
  <>
24
14
  <p className={styles.value}>
25
15
  {value}
26
- {afterValueIcon && (<span className={styles.afterIcon} onClick={onClickAfterValueIcon}>{renderItemIcon(afterValueIcon, afterValueColor)}</span>)}
16
+ {afterValueIcon && (<PlatformaticIcon iconName={afterValueIcon} color={afterValueIconColor} classes={styles.afterIcon} onClick={() => onClickAfterValueIcon} />)}
27
17
  </p>
28
18
  </>
29
19
  )
30
20
  }
31
- function Preview ({ title, value, isLink, children, afterValueIcon, afterValueColor, onClickAfterValueIcon }) {
21
+ function Preview ({ title, value, isLink, children, afterValueIcon, afterValueIconColor, onClickAfterValueIcon }) {
32
22
  return (
33
23
  <>
34
24
  <div className={styles.container}>
35
25
  <p className={styles.title}>{title}</p>
36
- {isLink ? renderLink(value) : renderParagraph(value, afterValueIcon, afterValueColor, onClickAfterValueIcon)}
26
+ {isLink ? renderLink(value) : renderParagraph(value, afterValueIcon, afterValueIconColor, onClickAfterValueIcon)}
37
27
  </div>
38
28
  {children}
39
29
  <HorizontalSeparator color='main-dark-green' opacity={20} marginBottom={10} marginTop={10} />
@@ -49,7 +39,10 @@ Preview.propTypes = {
49
39
  /**
50
40
  * value
51
41
  */
52
- value: PropTypes.string,
42
+ value: PropTypes.oneOfType([
43
+ PropTypes.string,
44
+ PropTypes.number
45
+ ]),
53
46
  /**
54
47
  * isLink
55
48
  */
@@ -61,7 +54,7 @@ Preview.propTypes = {
61
54
  /**
62
55
  * afterValueIcon
63
56
  */
64
- afterValueIcon: PropTypes.object,
57
+ afterValueIcon: PropTypes.string,
65
58
  /**
66
59
  * afterValueIconColor
67
60
  */
@@ -11,5 +11,5 @@
11
11
  @apply font-semibold;
12
12
  }
13
13
  .afterIcon {
14
- @apply ml-3 cursor-pointer;
14
+ @apply ml-3;
15
15
  }
@@ -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
@@ -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,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
@@ -18,23 +18,23 @@ const UpgradeIcon = ({ color = 'green', size = 'normal' }) => {
18
18
  <path
19
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
20
  stroke='none'
21
- stroke-width={6.5}
22
- stroke-linecap='round'
23
- stroke-linejoin='round'
21
+ strokeWidth={6.5}
22
+ strokeLinecap='round'
23
+ strokeLinejoin='round'
24
24
  />
25
25
  <path
26
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
27
  stroke='none'
28
- stroke-width={6.5}
29
- stroke-linecap='round'
30
- stroke-linejoin='round'
28
+ strokeWidth={6.5}
29
+ strokeLinecap='round'
30
+ strokeLinejoin='round'
31
31
  />
32
32
  <path
33
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
34
  stroke='none'
35
- stroke-width={6.5}
36
- stroke-linecap='round'
37
- stroke-linejoin='round'
35
+ strokeWidth={6.5}
36
+ strokeLinecap='round'
37
+ strokeLinejoin='round'
38
38
  />
39
39
  </svg>
40
40
  )
@@ -4,17 +4,26 @@ 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'
10
+ import CircleAddIcon from './CircleAddIcon'
11
+ import CircleBackIcon from './CircleBackIcon'
7
12
  import CircleExclamationIcon from './CircleExclamationIcon'
8
13
  import CircleCloseIcon from './CircleCloseIcon'
9
14
  import CircleCloseHoverIcon from './CircleCloseHoverIcon'
10
15
  import CloseIcon from './CloseIcon'
11
16
  import CopyIcon from './CopyIcon'
12
17
  import CreatedWorkspaceIcon from './CreatedWorkspaceIcon'
18
+ import DynamicWorkspaceIcon from './DynamicWorkspaceIcon'
13
19
  import GearIcon from './GearIcon'
20
+ import LiveIcon from './LiveIcon'
14
21
  import MetricsIcon from './MetricsIcon'
15
- import DynamicWorkspaceIcon from './DynamicWorkspaceIcon'
16
- import StaticWorkspaceIcon from './StaticWorkspaceIcon'
22
+ import PlayIcon from './PlayIcon'
17
23
  import PullRequestIcon from './PullRequestIcon'
24
+ import StaticWorkspaceIcon from './StaticWorkspaceIcon'
25
+ import StopIcon from './StopIcon'
26
+ import TerminalIcon from './TerminalIcon'
18
27
  import TriangleExclamationIcon from './TriangleExclamationIcon'
19
28
  import UpgradeIcon from './UpgradeIcon'
20
29
 
@@ -25,17 +34,26 @@ export default {
25
34
  AppIcon,
26
35
  AppListIcon,
27
36
  AppEmptyIcon,
37
+ CalendarIcon,
38
+ Calendar1Icon,
39
+ Calendar7Icon,
40
+ CircleAddIcon,
41
+ CircleBackIcon,
28
42
  CircleExclamationIcon,
29
43
  CircleCloseIcon,
30
44
  CircleCloseHoverIcon,
31
45
  CloseIcon,
32
46
  CopyIcon,
33
47
  CreatedWorkspaceIcon,
48
+ DynamicWorkspaceIcon,
34
49
  GearIcon,
50
+ LiveIcon,
35
51
  MetricsIcon,
36
- DynamicWorkspaceIcon,
37
- StaticWorkspaceIcon,
52
+ PlayIcon,
38
53
  PullRequestIcon,
54
+ StaticWorkspaceIcon,
55
+ StopIcon,
56
+ TerminalIcon,
39
57
  TriangleExclamationIcon,
40
58
  UpgradeIcon
41
59
  }
@@ -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
+ }
@@ -0,0 +1,35 @@
1
+ import React from 'react'
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
+ }
10
+
11
+ export default {
12
+ title: 'Platformatic/PlatformaticIcon',
13
+ component: PlatformaticIcon
14
+ }
15
+
16
+ const Template = (args) => <PlatformaticIcon {...args} />
17
+ export const PlatformaticIconDefault = Template.bind({})
18
+ PlatformaticIconDefault.args = {
19
+ iconName: 'CopyIcon',
20
+ onClick: () => alert('clicked')
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
+ }