@platformatic/ui-components 0.1.37 → 0.1.39

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.
Files changed (40) hide show
  1. package/dist/main.css +5 -5
  2. package/index.js +6 -3
  3. package/package.json +1 -1
  4. package/src/components/Button.jsx +59 -7
  5. package/src/components/Button.module.css +58 -28
  6. package/src/components/Common.module.css +20 -2
  7. package/src/components/HorizontalSeparator.jsx +7 -2
  8. package/src/components/HorizontalSeparator.module.css +4 -0
  9. package/src/components/Loadable.jsx +1 -1
  10. package/src/components/Loader.jsx +22 -0
  11. package/src/components/Loader.module.css +13 -0
  12. package/src/components/Logo.jsx +6 -2
  13. package/src/components/Logo.module.css +6 -0
  14. package/src/components/Modal.jsx +37 -3
  15. package/src/components/Modal.module.css +16 -2
  16. package/src/components/forms/Field.jsx +20 -0
  17. package/src/components/forms/Field.module.css +18 -0
  18. package/src/components/forms/Input.jsx +55 -0
  19. package/src/components/forms/Input.module.css +15 -0
  20. package/src/components/forms/Preview.jsx +15 -0
  21. package/src/components/forms/Preview.module.css +12 -0
  22. package/src/components/forms/ToggleSwitch.jsx +18 -0
  23. package/src/components/forms/ToggleSwitch.module.css +43 -0
  24. package/src/components/forms/index.js +8 -0
  25. package/src/components/icons/Icons.module.css +11 -0
  26. package/src/components/icons/RoundCloseHoverIcon.jsx +42 -0
  27. package/src/components/icons/RoundCloseIcon.jsx +32 -0
  28. package/src/components/icons/index.js +12 -3
  29. package/src/stories/Button.stories.jsx +25 -45
  30. package/src/stories/Loader.stories.jsx +44 -0
  31. package/src/stories/Modal.stories.jsx +7 -1
  32. package/src/stories/forms/Field.stories.jsx +81 -0
  33. package/src/stories/forms/Input.stories.jsx +56 -0
  34. package/src/stories/forms/Preview.stories.jsx +36 -0
  35. package/src/stories/forms/ToggleSwitch.stories.jsx +15 -0
  36. package/src/components/Input.jsx +0 -11
  37. package/src/components/Input.module.css +0 -7
  38. package/src/components/icons/CloseModalGreenHoverIcon.jsx +0 -37
  39. package/src/components/icons/CloseModalGreenIcon.jsx +0 -27
  40. package/src/stories/Input.stories.jsx +0 -15
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,13 +11,14 @@ 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
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'
20
20
  import Loadable from './src/components/Loadable'
21
+ import Loader from './src/components/Loader'
21
22
  import LoginButton from './src/components/LoginButton'
22
23
  import Logo from './src/components/Logo'
23
24
  import Modal from './src/components/Modal'
@@ -30,6 +31,7 @@ import TextWithLabel from './src/components/TextWithLabel'
30
31
  import TwoColumnsLayout from './src/components/layouts/TwoColumnsLayout'
31
32
  import Versions from './src/components/Versions'
32
33
  import VerticalSeparator from './src/components/VerticalSeparator'
34
+
33
35
  export {
34
36
  BorderedBox,
35
37
  BorderedText,
@@ -42,13 +44,14 @@ export {
42
44
  FollowUs,
43
45
  HorizontalSeparator,
44
46
  GHLoginButton,
47
+ Forms,
45
48
  Icons,
46
- Input,
47
49
  SideBar,
48
50
  Layout,
49
51
  List,
50
52
  ListElement,
51
53
  Loadable,
54
+ Loader,
52
55
  LoginButton,
53
56
  Logo,
54
57
  Modal,
@@ -60,5 +63,5 @@ export {
60
63
  TextWithLabel,
61
64
  TwoColumnsLayout,
62
65
  Versions,
63
- VerticalSeparator
66
+ VerticalSeparator,
64
67
  }
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.37",
4
+ "version": "0.1.39",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -1,16 +1,17 @@
1
1
  'use strict'
2
-
3
2
  import React from 'react'
3
+ import PropTypes from 'prop-types'
4
4
  import styles from './Button.module.css'
5
5
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
6
- export default function Button (props) {
7
- const { icon, label, buttonClass = 'secondary', color = 'green', disabled, size = 'large', bold = false, ...rest } = props
8
- let className = `${styles.button} ${styles[buttonClass + '-' + color]} ${styles['button-' + size]}`
6
+
7
+ function Button (props) {
8
+ const { icon, label, color, backgroundColor, size, disabled, bold, underlineEffect, bordered, ...rest } = props
9
+ let className = `${styles.button} ${styles['background-color-' + backgroundColor]} ${styles['color-' + color]} ${styles['button-' + size]}`
10
+ if (!bordered) className += ` ${styles['no-border']}`
9
11
  if (disabled) {
10
12
  className += ` ${styles.disabled}`
11
- if (buttonClass === 'transparent') {
12
- className += ` ${styles['disabled-transparent']}`
13
- }
13
+ } else {
14
+ if (underlineEffect) className += ` ${styles['underline-effect']}`
14
15
  }
15
16
  if (bold) className += ` ${styles.fontBold}`
16
17
 
@@ -21,3 +22,54 @@ export default function Button (props) {
21
22
  </button>
22
23
  )
23
24
  }
25
+
26
+ Button.propTypes = {
27
+ /**
28
+ * Icon
29
+ */
30
+ icon: PropTypes.object,
31
+ /**
32
+ * label
33
+ */
34
+ label: PropTypes.string,
35
+ /**
36
+ * color of text, icon and borders
37
+ */
38
+ color: PropTypes.oneOf(['main-green', 'dark-green', 'light-green', 'main-dark-blue', 'dark-blue', 'light-blue', 'white', 'error-red', 'tertiary-blue', 'transparent']),
39
+ /**
40
+ * background color of the button
41
+ */
42
+ backgroundColor: PropTypes.oneOf(['main-green', 'dark-green', 'light-green', 'main-dark-blue', 'dark-blue', 'light-blue', 'white', 'error-red', 'tertiary-blue', 'transparent']),
43
+ /**
44
+ * Size
45
+ */
46
+ size: PropTypes.oneOf(['small', 'medium', 'large', 'extra-large']),
47
+ /**
48
+ * Disabled
49
+ */
50
+ disabled: PropTypes.bool,
51
+ /**
52
+ * Bold
53
+ */
54
+ bold: PropTypes.bool,
55
+ /**
56
+ * Underline effect on hover
57
+ */
58
+ underlineEffect: PropTypes.bool,
59
+ /**
60
+ * Apply border: default true
61
+ */
62
+ bordered: PropTypes.bool
63
+ }
64
+
65
+ Button.defaultProps = {
66
+ color: 'main-dark-blue',
67
+ backgroundColor: 'transparent',
68
+ disabled: false,
69
+ size: 'large',
70
+ bold: false,
71
+ underlineEffect: false,
72
+ bordered: true
73
+ }
74
+
75
+ export default Button
@@ -1,5 +1,5 @@
1
1
  .button {
2
- @apply rounded text-center cursor-pointer font-normal;
2
+ @apply rounded text-center cursor-pointer font-normal rounded-md border border-solid box-border;
3
3
  }
4
4
  .fontBold {
5
5
  @apply font-semibold;
@@ -27,42 +27,72 @@
27
27
  .margin-right-extra-large {
28
28
  @apply mr-3;
29
29
  }
30
-
31
- .primary-green {
32
- @apply text-main-dark-blue bg-light-green;
30
+ .background-color-main-green {
31
+ @apply bg-main-green !important;
33
32
  }
34
- .secondary-green {
35
- @apply border-main-green text-main-green bg-none border border-solid box-border rounded-md;
33
+ .background-color-light-green {
34
+ @apply bg-light-green !important;
36
35
  }
37
- .transparent-green {
38
- @apply text-main-green border-0 bg-transparent hover:underline;
36
+ .background-color-dark-green {
37
+ @apply bg-dark-green !important;
39
38
  }
40
-
41
-
42
- .primary-red {
43
- @apply text-main-dark-blue bg-error-red;
39
+ .background-color-main-dark-blue{
40
+ @apply bg-main-dark-blue !important;
44
41
  }
45
- .secondary-red {
46
- @apply border-error-red text-error-red bg-none border border-solid box-border rounded-md;
42
+ .background-color-dark-blue{
43
+ @apply bg-dark-blue !important;
47
44
  }
48
- .transparent-red {
49
- @apply text-error-red border-0 bg-transparent hover:underline;
45
+ .background-color-light-blue{
46
+ @apply bg-light-blue !important;
50
47
  }
51
-
52
- .primary-white {
53
- @apply text-main-dark-blue bg-white;
48
+ .background-color-white{
49
+ @apply bg-white !important;
54
50
  }
55
- .secondary-white {
56
- @apply border-white text-white bg-none border border-solid box-border rounded-md;
51
+ .background-color-error-red{
52
+ @apply bg-error-red !important;
57
53
  }
58
- .transparent-white {
59
- @apply text-white border-0 bg-transparent hover:underline;
54
+ .background-color-tertiary-blue{
55
+ @apply bg-tertiary-blue !important;
56
+ }
57
+ .background-color-transparent{
58
+ @apply bg-transparent;
59
+ }
60
+ .color-main-green {
61
+ @apply text-main-green border-main-green;
62
+ }
63
+ .color-light-green {
64
+ @apply text-light-green border-light-green;
65
+ }
66
+ .color-dark-green {
67
+ @apply text-dark-green border-dark-green;
68
+ }
69
+ .color-main-dark-blue{
70
+ @apply text-main-dark-blue border-main-dark-blue;
71
+ }
72
+ .color-dark-blue{
73
+ @apply text-dark-blue border-dark-blue;
74
+ }
75
+ .color-light-blue{
76
+ @apply text-light-blue border-light-blue;
77
+ }
78
+ .color-white{
79
+ @apply text-white border-white;
80
+ }
81
+ .color-error-red{
82
+ @apply text-error-red border-error-red;
83
+ }
84
+ .color-tertiary-blue{
85
+ @apply text-tertiary-blue border-tertiary-blue;
86
+ }
87
+ .color-transparent{
88
+ @apply text-transparent border-transparent;
89
+ }
90
+ .no-border {
91
+ @apply border-0;
60
92
  }
61
-
62
93
  .disabled {
63
94
  @apply opacity-30 cursor-default;
64
95
  }
65
-
66
- .disabled-transparent {
67
- @apply hover:no-underline;
68
- }
96
+ .underline-effect {
97
+ @apply hover:underline;
98
+ }
@@ -1,7 +1,25 @@
1
+ .bordered {
2
+ @apply border border-solid box-border rounded-md;
3
+ }
4
+ .bordered--main-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 absolute -bottom-5 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
  }
@@ -2,7 +2,7 @@ import React, { useState, cloneElement, Children } from 'react'
2
2
  import styles from './Loadable.module.css'
3
3
  import { SpinnerCircular } from 'spinners-react'
4
4
 
5
- export default function List ({ ...props }) {
5
+ export default function Loadable ({ ...props }) {
6
6
  // If null then loading not started, if true then loading, if false then done loading
7
7
  const [loading, setLoading] = useState(null)
8
8
  const startLoading = (reset = false) => {
@@ -0,0 +1,22 @@
1
+ import React from 'react'
2
+ import styles from './Loader.module.css'
3
+ import { SpinnerCircular } from 'spinners-react'
4
+
5
+ export default function Loader ({ loading, children }) {
6
+ return (
7
+ <>
8
+ {
9
+ loading
10
+ ? (
11
+ <div className={styles.container} data-testid='loading'>
12
+ <div data-testid='loading-content' className={styles.content}>
13
+ <SpinnerCircular className={styles.spinner} thickness={180} size={60} />
14
+ <div className={styles.blurred}>{children}</div>
15
+ </div>
16
+ </div>
17
+ )
18
+ : children
19
+ }
20
+ </>
21
+ )
22
+ }
@@ -0,0 +1,13 @@
1
+ .container {
2
+ @apply fixed top-0 left-0 h-full w-full z-40;
3
+ }
4
+ .content {
5
+ @apply h-full w-full;
6
+ }
7
+ .spinner {
8
+ @apply absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-50;
9
+ }
10
+ .blurred {
11
+ @apply blur-sm;
12
+ }
13
+
@@ -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
  }
@@ -1,9 +1,9 @@
1
1
  .blur {
2
- @apply absolute top-[50%] left-[50%] z-0 w-[100vw] h-[100vh] translate-x-[-50%] translate-y-[-50%] z-[9999];
2
+ @apply absolute top-[50%] left-[50%] w-[100vw] h-[100vh] translate-x-[-50%] translate-y-[-50%] z-[9999];
3
3
  background-color: rgba(0, 0, 0, 0.75);
4
4
  }
5
5
  .container {
6
- @apply z-[9999];
6
+ @apply z-20;
7
7
  }
8
8
  .centered {
9
9
  @apply fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%]
@@ -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
+
@@ -0,0 +1,20 @@
1
+ import React from 'react'
2
+ import styles from './Field.module.css'
3
+ import HorizontalSeparator from '../HorizontalSeparator'
4
+
5
+ export default function Field ({ title, helper, children, disabled }) {
6
+ let className = `${styles.container}`
7
+ if (disabled) className += ` ${styles.disabled}`
8
+ return (
9
+ <>
10
+ <div className={className}>
11
+ <p className={styles.title}>{title}</p>
12
+ <p className={styles.helper}>{helper}</p>
13
+ <div className={styles.content}>
14
+ {children}
15
+ </div>
16
+ </div>
17
+ <HorizontalSeparator color='main-dark-green' opacity={20} marginBottom={10} marginTop={10} />
18
+ </>
19
+ )
20
+ }
@@ -0,0 +1,18 @@
1
+ .container {
2
+ @apply flex flex-col;
3
+ }
4
+ .title{
5
+ @apply text-xl font-semibold text-main-dark-blue;
6
+ }
7
+ .helper{
8
+ @apply text-sm text-main-dark-blue pb-4;
9
+ }
10
+ .content {
11
+ @apply flex gap-x-1 w-full;
12
+ }
13
+ .content button {
14
+ @apply shrink-0;
15
+ }
16
+ .disabled {
17
+ @apply opacity-20;
18
+ }
@@ -0,0 +1,55 @@
1
+ 'use strict'
2
+ import React from 'react'
3
+ import PropTypes from 'prop-types'
4
+ import styles from './Input.module.css'
5
+ import commonStyles from '../Common.module.css'
6
+ function Input ({ placeholder, value, name, borderColor, errorMessage, onChange, disabled }) {
7
+ const className = styles.inputContainer + ' ' + commonStyles[`bordered--${borderColor}`] + ' ' + commonStyles[`text--${borderColor}`] + ' ' + commonStyles.padded
8
+ return (
9
+ <div className={styles.container}>
10
+ <div className={className}>
11
+ <input type='text' name={name} value={value} placeholder={placeholder} className={styles.fullWidth} onChange={onChange} disabled={disabled} />
12
+ </div>
13
+ {errorMessage.length > 0 && <span className={commonStyles['error-message']}>{errorMessage}</span>}
14
+ </div>
15
+ )
16
+ }
17
+
18
+ Input.propTypes = {
19
+ /**
20
+ * placeholder
21
+ */
22
+ placeholder: PropTypes.string,
23
+ /**
24
+ * value
25
+ */
26
+ value: PropTypes.string,
27
+ /**
28
+ * name
29
+ */
30
+ name: PropTypes.string,
31
+ /**
32
+ * color of border
33
+ */
34
+ borderColor: PropTypes.oneOf(['main-green', 'main-dark-blue']),
35
+ /**
36
+ * onChange
37
+ */
38
+ onChange: PropTypes.func,
39
+ /**
40
+ * Disabled
41
+ */
42
+ disabled: PropTypes.bool
43
+ }
44
+
45
+ Input.defaultProps = {
46
+ placeholder: '',
47
+ value: null,
48
+ name: '',
49
+ borderColor: 'main-green',
50
+ errorMessage: '',
51
+ onChange: () => {},
52
+ disabled: false
53
+ }
54
+
55
+ export default Input
@@ -0,0 +1,15 @@
1
+ .container {
2
+ @apply flex flex-col w-full relative;
3
+ }
4
+ .inputContainer {
5
+ @apply flex h-10 border border-solid box-border rounded-md;
6
+ }
7
+ .fullWidth {
8
+ @apply w-full;
9
+ }
10
+ .input {
11
+ @apply focus:outline-none focus-within:outline-none focus-visible:outline-none;
12
+ }
13
+ [type='text']:focus {
14
+ outline: none;
15
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import styles from './Preview.module.css'
3
+ import HorizontalSeparator from '../HorizontalSeparator'
4
+
5
+ export default function Preview ({ title, value, isLink = false }) {
6
+ return (
7
+ <>
8
+ <div className={styles.container}>
9
+ <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>}
11
+ </div>
12
+ <HorizontalSeparator color='main-dark-green' opacity={20} marginBottom={10} marginTop={10} />
13
+ </>
14
+ )
15
+ }
@@ -0,0 +1,12 @@
1
+ .container {
2
+ @apply flex flex-col
3
+ }
4
+ .title{
5
+ @apply text-sm text-main-dark-blue pb-1;
6
+ }
7
+ .value{
8
+ @apply text-xl font-semibold text-main-dark-blue;
9
+ }
10
+ .link {
11
+ @apply font-semibold;
12
+ }
@@ -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
+ }