@platformatic/ui-components 0.1.36 → 0.1.38

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
@@ -660,11 +660,6 @@ video {
660
660
  color: rgb(255 255 255 / var(--tw-text-opacity));
661
661
  }
662
662
 
663
- .text-dark-green {
664
- --tw-text-opacity: 1;
665
- color: rgb(2 120 63 / var(--tw-text-opacity));
666
- }
667
-
668
663
  .text-main-green {
669
664
  --tw-text-opacity: 1;
670
665
  color: rgb(33 250 144 / var(--tw-text-opacity));
@@ -675,6 +670,11 @@ video {
675
670
  color: rgb(250 33 33 / var(--tw-text-opacity));
676
671
  }
677
672
 
673
+ .text-dark-green {
674
+ --tw-text-opacity: 1;
675
+ color: rgb(2 120 63 / var(--tw-text-opacity));
676
+ }
677
+
678
678
  .blur {
679
679
  --tw-blur: blur(8px);
680
680
  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/index.js CHANGED
@@ -11,9 +11,9 @@ import DropDown from './src/components/DropDown'
11
11
  import FollowUs from './src/components/FollowUs'
12
12
  import GHLoginButton from './src/components/GHLoginButton'
13
13
  import HorizontalSeparator from './src/components/HorizontalSeparator'
14
+ import Forms from './src/components/forms'
14
15
  import Icons from './src/components/icons'
15
- import Input from './src/components/Input'
16
- import Sidebar from './src/components/Sidebar'
16
+ import SideBar from './src/components/SideBar'
17
17
  import Layout from './src/components/layouts/Layout'
18
18
  import List from './src/components/List'
19
19
  import ListElement from './src/components/ListElement'
@@ -30,6 +30,7 @@ import TextWithLabel from './src/components/TextWithLabel'
30
30
  import TwoColumnsLayout from './src/components/layouts/TwoColumnsLayout'
31
31
  import Versions from './src/components/Versions'
32
32
  import VerticalSeparator from './src/components/VerticalSeparator'
33
+
33
34
  export {
34
35
  BorderedBox,
35
36
  BorderedText,
@@ -42,9 +43,9 @@ export {
42
43
  FollowUs,
43
44
  HorizontalSeparator,
44
45
  GHLoginButton,
46
+ Forms,
45
47
  Icons,
46
- Input,
47
- Sidebar,
48
+ SideBar,
48
49
  Layout,
49
50
  List,
50
51
  ListElement,
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.36",
4
+ "version": "0.1.38",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -38,7 +38,6 @@
38
38
  @apply text-main-green border-0 bg-transparent hover:underline;
39
39
  }
40
40
 
41
-
42
41
  .primary-red {
43
42
  @apply text-main-dark-blue bg-error-red;
44
43
  }
@@ -59,10 +58,13 @@
59
58
  @apply text-white border-0 bg-transparent hover:underline;
60
59
  }
61
60
 
61
+ .tertiary-white {
62
+ @apply bg-main-dark-blue border-0 text-white !important;
63
+ }
64
+
62
65
  .disabled {
63
66
  @apply opacity-30 cursor-default;
64
67
  }
65
-
66
68
  .disabled-transparent {
67
69
  @apply hover:no-underline;
68
70
  }
@@ -1,7 +1,25 @@
1
+ .bordered {
2
+ @apply border border-solid box-border rounded-md;
3
+ }
4
+ .bordered--green {
5
+ @apply border-main-green
6
+ }
7
+ .bordered--main-dark-blue {
8
+ @apply border-main-dark-blue;
9
+ }
10
+
11
+ .error-message {
12
+ @apply text-error-red text-xs px-2;
13
+ }
14
+
1
15
  .padded {
2
16
  @apply px-2 py-2.5;
3
17
  }
4
18
 
5
- .bordered {
6
- @apply border border-solid box-border rounded-md;
19
+ .text--green {
20
+ @apply text-main-green
21
+ }
22
+ .text--main-dark-blue {
23
+ @apply text-main-dark-blue;
7
24
  }
25
+
@@ -1,9 +1,14 @@
1
1
  'use strict'
2
2
  import React from 'react'
3
3
  import styles from './HorizontalSeparator.module.css'
4
- export default function HorizontalSeparator ({ marginTop = 4, marginBottom = 4 }) {
4
+ export default function HorizontalSeparator ({ marginTop = 4, marginBottom = 4, color = 'dark-green', opacity = 1 }) {
5
5
  function getClassName () {
6
- return 'text-dark-green ' + (marginTop === marginBottom ? `${styles['marginY-' + marginTop]}` : `${styles['marginT-' + marginTop]} ${styles['marginB-' + marginBottom]}`)
6
+ let className = `text-${color} `
7
+ // margin
8
+ className += (marginTop === marginBottom ? `${styles['marginY-' + marginTop]}` : `${styles['marginT-' + marginTop]} ${styles['marginB-' + marginBottom]}`)
9
+ // opacity
10
+ if (opacity > 1) className += ' ' + styles[`apply-opacity-${opacity}`]
11
+ return className
7
12
  }
8
13
 
9
14
  return <hr className={getClassName()} />
@@ -20,4 +20,8 @@
20
20
 
21
21
  .marginB-10 {
22
22
  @apply mb-10;
23
+ }
24
+
25
+ .apply-opacity-20 {
26
+ @apply opacity-20;
23
27
  }
@@ -1,5 +1,7 @@
1
1
  import React from 'react'
2
- export default function Logo ({ width = 107, heigth = 86 }) {
2
+ import styles from './Logo.module.css'
3
+ export default function Logo ({ width = 107, heigth = 86, color = 'white' }) {
4
+ const className = styles[`${color}`]
3
5
  return (
4
6
  <svg
5
7
  width={width}
@@ -7,10 +9,12 @@ export default function Logo ({ width = 107, heigth = 86 }) {
7
9
  viewBox='0 0 107 86'
8
10
  fill='none'
9
11
  xmlns='http://www.w3.org/2000/svg'
12
+ className={className}
10
13
  >
11
14
  <path
15
+ id='platformatic-cloud'
12
16
  d='M30.8197 62.5803H89.7919V62.5614C92.0266 62.4574 94.2096 61.8539 96.1799 60.7954C98.1502 59.7369 99.8577 58.2503 101.177 56.4452C102.496 54.6401 103.392 52.5624 103.801 50.3652C104.21 48.168 104.12 45.9072 103.538 43.7493C102.956 41.5915 101.897 39.5915 100.438 37.8967C98.9799 36.202 97.1596 34.8556 95.1114 33.9567C93.0632 33.0579 90.8392 32.6294 88.6032 32.703C86.3673 32.7765 84.1763 33.3502 82.1917 34.3817C80.9669 31.5572 79.1131 29.0491 76.7716 27.0482C74.43 25.0473 71.6623 23.6064 68.6792 22.8352M18.1691 22.8352C13.8266 23.9537 9.97973 26.4828 7.23367 30.0244C4.48761 33.566 2.99827 37.9192 3 42.399C3.00173 46.8787 4.49443 51.2307 7.24322 54.7702C9.992 58.3098 13.8409 60.8359 18.1841 61.951'
13
- stroke='white'
17
+ stroke='none'
14
18
  strokeWidth={4.21053}
15
19
  strokeLinecap='round'
16
20
  strokeLinejoin='round'
@@ -0,0 +1,6 @@
1
+ .white > path[id='platformatic-cloud']{
2
+ @apply stroke-white
3
+ }
4
+ .main-dark-blue > path[id='platformatic-cloud']{
5
+ @apply stroke-main-dark-blue
6
+ }
@@ -1,9 +1,12 @@
1
1
  import React, { useState } from 'react'
2
2
  import useEscapeKey from '../hooks/useEscapeKey'
3
3
  import CloseModalIcon from './icons/CloseModalIcon'
4
- import CloseModalGreenIcon from './icons/CloseModalGreenIcon'
5
- import CloseModalGreenHoverIcon from './icons/CloseModalGreenHoverIcon'
4
+ import RoundCloseIcon from './icons/RoundCloseIcon'
5
+ import RoundCloseHoverIcon from './icons/RoundCloseHoverIcon'
6
+ import Logo from './Logo'
7
+ import HorizontalSeparator from './HorizontalSeparator'
6
8
  import styles from './Modal.module.css'
9
+
7
10
  export default function Modal (props) {
8
11
  const { setIsOpen, title, layout = 'info' } = props
9
12
  const [isHoverCloseModal, setIsHoverCloseModal] = useState(false)
@@ -31,6 +34,7 @@ export default function Modal (props) {
31
34
  </>
32
35
  )
33
36
  break
37
+
34
38
  case 'invite':
35
39
  whichModal = (
36
40
  <>
@@ -44,7 +48,7 @@ export default function Modal (props) {
44
48
  onMouseEnter={() => setIsHoverCloseModal(true)}
45
49
  onMouseLeave={() => setIsHoverCloseModal(false)}
46
50
  >
47
- {isHoverCloseModal ? <CloseModalGreenHoverIcon /> : <CloseModalGreenIcon />}
51
+ {isHoverCloseModal ? <RoundCloseHoverIcon /> : <RoundCloseIcon />}
48
52
  </div>
49
53
  </div>
50
54
  <p className={styles.titleInvite}>{title}</p>
@@ -54,6 +58,36 @@ export default function Modal (props) {
54
58
  </>
55
59
  )
56
60
  break
61
+
62
+ case 'fullscreen':
63
+ whichModal = (
64
+ <>
65
+ <div className={`${styles.container} ${styles.fullscreen}`}>
66
+ <div className={styles.modalFullscreen}>
67
+ <div className={styles.headerInvite}>
68
+ <div
69
+ className={styles.close}
70
+ onClick={() => setIsOpen(false)}
71
+ onMouseEnter={() => setIsHoverCloseModal(true)}
72
+ onMouseLeave={() => setIsHoverCloseModal(false)}
73
+ >
74
+ {isHoverCloseModal ? <RoundCloseHoverIcon color='main-dark-blue' /> : <RoundCloseIcon color='main-dark-blue' />}
75
+ </div>
76
+ </div>
77
+ <div className={styles.contentFullscreen}>
78
+ <div className={styles.titleFullscreen}>
79
+ <Logo width={100} heigth={80} color='main-dark-blue' />
80
+ <h3>PLATFORMATIC</h3>
81
+ </div>
82
+ <HorizontalSeparator marginTop={10} marginBottom={10} color='main-dark-blue' opacity={20} />
83
+ <div>{props.children}</div>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </>
88
+ )
89
+ break
90
+
57
91
  default:
58
92
  break
59
93
  }
@@ -17,6 +17,9 @@
17
17
  .modalInvite {
18
18
  @apply bg-main-dark-blue border-light-green border shadow-wrap shadow-main-green max-w-[432px] max-h-[300px];
19
19
  }
20
+ .fullscreen {
21
+ @apply fixed top-0 left-0 bg-light-blue h-screen w-full min-h-screen min-w-full py-4 pl-20 pr-4 overflow-y-auto;
22
+ }
20
23
  .header {
21
24
  @apply flex justify-between items-center;
22
25
  }
@@ -35,3 +38,14 @@
35
38
  .titleInvite {
36
39
  @apply font-bold text-lg text-main-green text-center;
37
40
  }
41
+ .contentFullscreen {
42
+ @apply h-auto max-w-[70%] w-full pt-4;
43
+ }
44
+
45
+ .titleFullscreen {
46
+ @apply inline-flex items-center;
47
+ }
48
+ .titleFullscreen h3 {
49
+ @apply text-[22px] text-dark-blue font-bold tracking-widest mx-3;
50
+ }
51
+
@@ -2,10 +2,10 @@ import React, { useState } from 'react'
2
2
  import PuzzleIcon from './icons/PuzzleIcon'
3
3
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
4
4
  import { faChevronLeft, faPlus } from '@fortawesome/free-solid-svg-icons'
5
- import styles from './Sidebar.module.css'
5
+ import styles from './SideBar.module.css'
6
6
  import ReactTooltip from 'react-tooltip'
7
7
  import HorizontalSeparator from './HorizontalSeparator'
8
- export default function Sidebar (props) {
8
+ export default function SideBar (props) {
9
9
  const { title, defaultSelected = 0, onClickItemSelectedParent = () => {}, items = [], onClickAdd = () => {}, addTitle = 'Add' } = props
10
10
  const [collapsed, setCollapsed] = useState(false)
11
11
  const [selectedItem, setSelectedItem] = useState(defaultSelected)
@@ -0,0 +1,15 @@
1
+ 'use strict'
2
+ import React from 'react'
3
+ import styles from './Input.module.css'
4
+ import commonStyles from '../Common.module.css'
5
+ export default function Input ({ placeholder, value, name, borderColor = 'green', errorMessage = '', onChange = () => {} }) {
6
+ const className = styles.inputContainer + ' ' + commonStyles[`bordered--${borderColor}`] + ' ' + commonStyles[`text--${borderColor}`] + ' ' + commonStyles.padded
7
+ return (
8
+ <>
9
+ <div className={className}>
10
+ <input type='text' name={name} value={value} placeholder={placeholder} className='grow' onChange={onChange} />
11
+ </div>
12
+ {errorMessage.length > 0 && <span className={commonStyles['error-message']}>{errorMessage}</span>}
13
+ </>
14
+ )
15
+ }
@@ -0,0 +1,9 @@
1
+ .inputContainer {
2
+ @apply flex justify-between w-full h-10 border border-solid box-border rounded-md;
3
+ }
4
+ .input {
5
+ @apply grow focus:outline-none focus-within:outline-none focus-visible:outline-none;
6
+ }
7
+ [type='text']:focus {
8
+ outline: none;
9
+ }
@@ -0,0 +1,18 @@
1
+ 'use strict'
2
+ import React from 'react'
3
+ import styles from './ToggleSwitch.module.css'
4
+ import commonStyles from '../Common.module.css'
5
+ export default function ToggleSwitch ({ name, label, errorMessage = '', onChange = () => {} }) {
6
+ return (
7
+ <>
8
+ <div className={styles.container}>
9
+ <label className={styles.switch}>
10
+ <input type='checkbox' name={name} onChange={onChange} />
11
+ <span className={`${styles.slider} ${styles.round}`} />
12
+ </label>
13
+ <span className={styles.label}>{label}</span>
14
+ </div>
15
+ {errorMessage.length > 0 && <span className={commonStyles['error-message']}>{errorMessage}</span>}
16
+ </>
17
+ )
18
+ }
@@ -0,0 +1,43 @@
1
+ .container {
2
+ @apply flex w-full h-10 items-center;
3
+ }
4
+ .switch {
5
+ @apply relative inline-block w-[50px] h-[24px];
6
+ }
7
+ .switch input {
8
+ @apply opacity-0 w-0 h-0;
9
+ }
10
+ .slider {
11
+ @apply absolute cursor-pointer top-0 left-0 right-0 bottom-0 h-full;
12
+ background-color: #707070;
13
+ -webkit-transition: .4s;
14
+ transition: .4s;
15
+ }
16
+ .label {
17
+ @apply px-2 text-xs font-normal text-main-dark-blue;
18
+ }
19
+ .slider:before {
20
+ @apply absolute h-4 w-4 left-[4px] bottom-[4px] bg-white;
21
+ content: "";
22
+ -webkit-transition: .4s;
23
+ transition: .4s;
24
+ }
25
+
26
+ input:checked + .slider {
27
+ @apply bg-main-green;
28
+ }
29
+
30
+ input:checked + .slider:before {
31
+ -webkit-transform: translateX(26px);
32
+ -ms-transform: translateX(26px);
33
+ transform: translateX(26px);
34
+ }
35
+
36
+ /* Rounded sliders */
37
+ .slider.round {
38
+ border-radius: 100px;
39
+ }
40
+
41
+ .slider.round:before {
42
+ @apply rounded-full;
43
+ }
@@ -0,0 +1,6 @@
1
+ import ToggleSwitch from './ToggleSwitch'
2
+ import Input from './Input'
3
+
4
+ export default {
5
+ ToggleSwitch, Input
6
+ }
@@ -13,6 +13,17 @@
13
13
  .white > path {
14
14
  @apply stroke-white;
15
15
  }
16
+ .main-dark-blue > circle,
17
+ .main-dark-blue > rect,
18
+ .main-dark-blue > path {
19
+ @apply stroke-main-dark-blue;
20
+ }
21
+ .fill-circle-green > circle {
22
+ @apply fill-white;
23
+ }
24
+ .fill-circle-main-dark-blue > circle {
25
+ @apply fill-main-dark-blue;
26
+ }
16
27
 
17
28
  .noShrinkForFlex {
18
29
  @apply shrink-0
@@ -0,0 +1,42 @@
1
+ import * as React from 'react'
2
+ import styles from './Icons.module.css'
3
+
4
+ const RoundCloseHoverIcon = ({ color = 'green' }) => {
5
+ const className = styles[`${color}`] + ' ' + styles[`fill-circle-${color}`]
6
+ return (
7
+ <svg
8
+ width={24}
9
+ height={24}
10
+ viewBox='0 0 24 24'
11
+ fill='none'
12
+ xmlns='http://www.w3.org/2000/svg'
13
+ className={className}
14
+ >
15
+ <circle
16
+ cx={12}
17
+ cy={12}
18
+ r={11.25}
19
+ fill='none'
20
+ fillOpacity={0.2}
21
+ stroke='none'
22
+ strokeWidth={1.5}
23
+ />
24
+ <path
25
+ d='M6 6L18 18'
26
+ stroke='none'
27
+ strokeWidth={1.5}
28
+ strokeLinecap='round'
29
+ strokeLinejoin='round'
30
+ />
31
+ <path
32
+ d='M6 18L18 6'
33
+ stroke='none'
34
+ strokeWidth={1.5}
35
+ strokeLinecap='round'
36
+ strokeLinejoin='round'
37
+ />
38
+ </svg>
39
+ )
40
+ }
41
+
42
+ export default RoundCloseHoverIcon
@@ -0,0 +1,32 @@
1
+ import * as React from 'react'
2
+ import styles from './Icons.module.css'
3
+
4
+ const RoundCloseIcon = ({ color = 'green' }) => {
5
+ const className = styles[`${color}`]
6
+ return (
7
+ <svg
8
+ width={24}
9
+ height={24}
10
+ viewBox='0 0 24 24'
11
+ fill='none'
12
+ xmlns='http://www.w3.org/2000/svg'
13
+ className={className}
14
+ >
15
+ <circle cx={12} cy={12} r={11.5} stroke='none' />
16
+ <path
17
+ d='M6 6L18 18'
18
+ stroke='none'
19
+ strokeLinecap='round'
20
+ strokeLinejoin='round'
21
+ />
22
+ <path
23
+ d='M6 18L18 6'
24
+ stroke='none'
25
+ strokeLinecap='round'
26
+ strokeLinejoin='round'
27
+ />
28
+ </svg>
29
+ )
30
+ }
31
+
32
+ export default RoundCloseIcon
@@ -2,11 +2,11 @@ import ApiIcon from './ApiIcon'
2
2
  import ApiIconClosed from './ApiIconClosed'
3
3
  import ApiEmptyIcon from './ApiEmptyIcon'
4
4
  import CloseModalIcon from './CloseModalIcon'
5
- import CloseModalGreenIcon from './CloseModalGreenIcon'
6
- import CloseModalGreenHoverIcon from './CloseModalGreenHoverIcon'
5
+ import RoundCloseIcon from './RoundCloseIcon'
6
+ import RoundCloseHoverIcon from './RoundCloseHoverIcon'
7
7
  import MetricsIcon from './MetricsIcon'
8
8
  import PullRequestIcon from './PullRequestIcon'
9
9
 
10
10
  export default {
11
- ApiIcon, ApiIconClosed, ApiEmptyIcon, CloseModalIcon, CloseModalGreenIcon, CloseModalGreenHoverIcon, MetricsIcon, PullRequestIcon
11
+ ApiIcon, ApiIconClosed, ApiEmptyIcon, CloseModalIcon, RoundCloseIcon, RoundCloseHoverIcon, MetricsIcon, PullRequestIcon
12
12
  }
@@ -12,7 +12,7 @@ export default {
12
12
  type: 'string',
13
13
  control: {
14
14
  type: 'radio',
15
- options: ['info', 'invite']
15
+ options: ['info', 'invite', 'fullscreen']
16
16
  }
17
17
  }
18
18
  }
@@ -92,3 +92,9 @@ InviteLayout.args = {
92
92
  title: 'Give me an invite',
93
93
  layout: 'invite'
94
94
  }
95
+
96
+ export const FullscreenLayout = Template.bind({})
97
+ FullscreenLayout.args = {
98
+ title: 'Give me an invite',
99
+ layout: 'fullscreen'
100
+ }
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
  import { useState } from 'react'
3
- import Sidebar from '../components/Sidebar'
3
+ import SideBar from '../components/SideBar'
4
4
  import BorderedBox from '../components/BorderedBox'
5
5
 
6
6
  const divStyle = {
@@ -11,8 +11,8 @@ const divStyle = {
11
11
  }
12
12
 
13
13
  export default {
14
- title: 'Platformatic/Sidebar',
15
- component: Sidebar,
14
+ title: 'Platformatic/SideBar',
15
+ component: SideBar,
16
16
  decorators: [
17
17
  (Story) => (
18
18
  <div style={divStyle}>
@@ -23,17 +23,17 @@ export default {
23
23
  ]
24
24
  }
25
25
 
26
- const Template = (args) => <Sidebar {...args} />
26
+ const Template = (args) => <SideBar {...args} />
27
27
 
28
- export const EmptySidebar = Template.bind({})
28
+ export const EmptySideBar = Template.bind({})
29
29
 
30
- EmptySidebar.args = {
31
- title: 'Sidebar bar empty',
30
+ EmptySideBar.args = {
31
+ title: 'SideBar bar empty',
32
32
  addTitle: 'Create',
33
- onClickAdd: () => alert('clicked on add EmptySidebar')
33
+ onClickAdd: () => alert('clicked on add EmptySideBar')
34
34
  }
35
35
 
36
- const FullSidebarTemplate = (args) => {
36
+ const FullSideBarTemplate = (args) => {
37
37
  const [items, setItems] = useState(['a very very very very very long title 1', 'Title number 2'])
38
38
  function onClickAdd () {
39
39
  const tmpItem = items.map(item => item)
@@ -42,14 +42,14 @@ const FullSidebarTemplate = (args) => {
42
42
  }
43
43
 
44
44
  return (
45
- <Sidebar items={items} onClickAdd={() => onClickAdd()} {...args} />
45
+ <SideBar items={items} onClickAdd={() => onClickAdd()} {...args} />
46
46
  )
47
47
  }
48
48
 
49
- export const FullSidebar = FullSidebarTemplate.bind({})
49
+ export const FullSideBar = FullSideBarTemplate.bind({})
50
50
 
51
- FullSidebar.args = {
52
- title: 'Sidebar bar Full',
51
+ FullSideBar.args = {
52
+ title: 'SideBar bar Full',
53
53
  addTitle: 'Create',
54
54
  onClickItemSelected: (index) => alert('selected: ' + index)
55
55
  }
@@ -0,0 +1,56 @@
1
+ 'use strict'
2
+ import React, { useState } from 'react'
3
+ import Input from '../../components/forms/Input'
4
+ export default {
5
+ title: 'Platformatic/Input',
6
+ component: Input
7
+ }
8
+
9
+ const Template = (args) => <Input {...args} />
10
+
11
+ export const Default = Template.bind({})
12
+
13
+ Default.args = {
14
+ name: 'test',
15
+ placeholder: 'Platformatic'
16
+ }
17
+
18
+ const TemplateBorderMainDarkBlue = (args) => <div style={{ backgroundColor: 'white', padding: '2px' }}><Input {...args} /></div>
19
+
20
+ export const BorderMainDarkBlue = TemplateBorderMainDarkBlue.bind({})
21
+
22
+ BorderMainDarkBlue.args = {
23
+ name: 'test',
24
+ placeholder: 'Platformatic',
25
+ borderColor: 'main-dark-blue'
26
+ }
27
+
28
+ export const DefaultInvalid = Template.bind({})
29
+
30
+ DefaultInvalid.args = {
31
+ name: 'test',
32
+ placeholder: 'Platformatic',
33
+ errorMessage: 'This is an error message'
34
+ }
35
+
36
+ const TemplateValuedAndAlertChange = (args) => {
37
+ const [value, setValue] = useState('Initial value')
38
+
39
+ function handleChange (event) {
40
+ setValue(event.target.value)
41
+ }
42
+
43
+ return (
44
+ <>
45
+ <p>Value of the input {value}</p>
46
+ <Input {...args} value={value} onChange={handleChange} />
47
+ </>
48
+ )
49
+ }
50
+
51
+ export const ValuedAndAlertChange = TemplateValuedAndAlertChange.bind({})
52
+
53
+ ValuedAndAlertChange.args = {
54
+ name: 'test',
55
+ placeholder: 'Platformatic'
56
+ }
@@ -0,0 +1,15 @@
1
+ 'use strict'
2
+ import ToggleSwitch from '../../components/forms/ToggleSwitch'
3
+ export default {
4
+ title: 'Platformatic/ToggleSwitch',
5
+ component: ToggleSwitch
6
+ }
7
+
8
+ const Template = (args) => <ToggleSwitch {...args} />
9
+
10
+ export const Default = Template.bind({})
11
+
12
+ Default.args = {
13
+ name: 'test',
14
+ label: 'This is a label'
15
+ }
@@ -1,11 +0,0 @@
1
- 'use strict'
2
- import React from 'react'
3
- import styles from './Input.module.css'
4
- import commonStyles from './Common.module.css'
5
- export default function Input ({ placeholder, value, name }) {
6
- return (
7
- <div className={`${styles.inputContainer} ${commonStyles.padded}`}>
8
- <input type='text' name={name} value={value} placeholder={placeholder} className='grow' />
9
- </div>
10
- )
11
- }
@@ -1,7 +0,0 @@
1
- .inputContainer {
2
- @apply flex justify-between w-full h-10 text-white border-main-green border border-solid box-border rounded-md;
3
- }
4
-
5
- .input {
6
- @apply grow focus:outline-none
7
- }
@@ -1,37 +0,0 @@
1
- import * as React from 'react'
2
-
3
- const CloseModalGreenHoverIcon = () => (
4
- <svg
5
- width={24}
6
- height={24}
7
- viewBox='0 0 24 24'
8
- fill='none'
9
- xmlns='http://www.w3.org/2000/svg'
10
- >
11
- <circle
12
- cx={12}
13
- cy={12}
14
- r={11.25}
15
- fill='#21FA90'
16
- fillOpacity={0.2}
17
- stroke='#21FA90'
18
- strokeWidth={1.5}
19
- />
20
- <path
21
- d='M6 6L18 18'
22
- stroke='#21FA90'
23
- strokeWidth={1.5}
24
- strokeLinecap='round'
25
- strokeLinejoin='round'
26
- />
27
- <path
28
- d='M6 18L18 6'
29
- stroke='#21FA90'
30
- strokeWidth={1.5}
31
- strokeLinecap='round'
32
- strokeLinejoin='round'
33
- />
34
- </svg>
35
- )
36
-
37
- export default CloseModalGreenHoverIcon
@@ -1,27 +0,0 @@
1
- import * as React from 'react'
2
-
3
- const CloseModalGreenIcon = () => (
4
- <svg
5
- width={24}
6
- height={24}
7
- viewBox='0 0 24 24'
8
- fill='none'
9
- xmlns='http://www.w3.org/2000/svg'
10
- >
11
- <circle cx={12} cy={12} r={11.5} stroke='#21FA90' />
12
- <path
13
- d='M6 6L18 18'
14
- stroke='#21FA90'
15
- strokeLinecap='round'
16
- strokeLinejoin='round'
17
- />
18
- <path
19
- d='M6 18L18 6'
20
- stroke='#21FA90'
21
- strokeLinecap='round'
22
- strokeLinejoin='round'
23
- />
24
- </svg>
25
- )
26
-
27
- export default CloseModalGreenIcon
@@ -1,15 +0,0 @@
1
- 'use strict'
2
- import Input from '../components/Input'
3
- export default {
4
- title: 'Platformatic/Input',
5
- component: Input
6
- }
7
-
8
- const Template = (args) => <Input {...args} />
9
-
10
- export const Default = Template.bind({})
11
-
12
- Default.args = {
13
- name: 'test',
14
- placeholder: 'Platformatic'
15
- }