@platformatic/ui-components 0.1.34 → 0.1.35

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/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.34",
4
+ "version": "0.1.35",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -1,5 +1,5 @@
1
1
  .box {
2
- @apply p-5 m-0 md:p-0 md:m-24 flex flex-col;
2
+ @apply p-5 m-0 md:px-24 md:py-56 flex flex-col;
3
3
  }
4
4
 
5
5
  .justifyCentered {
@@ -16,8 +16,10 @@
16
16
  @apply hover:cursor-pointer relative pr-6;
17
17
  }
18
18
  .menu {
19
- @apply absolute border-solid border border-white p-3 bg-light-blue mt-8 rounded-md z-[999] text-sm;
19
+ @apply absolute border-solid border border-white px-0 py-1 bg-light-blue mt-8 rounded-md z-[999] text-sm min-w-[175px];
20
20
  }
21
21
  .item {
22
- @apply py-3 text-main-dark-blue border-t border-main-dark-blue first:border-t-0 text-sm uppercase hover:font-semibold hover:cursor-pointer;
22
+ @apply py-3 px-3 text-main-dark-blue first:border-t-0 text-sm uppercase hover:font-semibold hover:cursor-pointer tracking-[0.15em];
23
+ /* it's a workaround due to opacity... */
24
+ border-top: 1px solid rgba(0, 40, 61, 0.2);;
23
25
  }
@@ -3,8 +3,8 @@ import React, { useEffect, useState } from 'react'
3
3
  import styles from './TabbedWindow.module.css'
4
4
 
5
5
  export default function TabbedWindow (props) {
6
- const [selected, setSelected] = useState(0)
7
- const { tabs } = props
6
+ const { tabs, defaultSelected = 0, callbackSelected = () => {} } = props
7
+ const [selected, setSelected] = useState(defaultSelected)
8
8
  const headers = []
9
9
  const components = []
10
10
  tabs.forEach((tab) => {
@@ -17,12 +17,17 @@ export default function TabbedWindow (props) {
17
17
  currentComponent = components[selected]
18
18
  }, [selected])
19
19
 
20
+ function setCurrentTab (index) {
21
+ setSelected(index)
22
+ callbackSelected(index)
23
+ }
24
+
20
25
  return (
21
26
  <div className={styles['tabbed-container']}>
22
27
  <div className={styles['tabs-header']}>
23
28
  {headers.map((header, index) => {
24
29
  return (
25
- <span onClick={() => setSelected(index)} key={index} className={`${styles.tab} ${selected === index ? styles['selected-tab'] : ''}`}>
30
+ <span onClick={() => setCurrentTab(index)} key={index} className={`${styles.tab} ${selected === index ? styles['selected-tab'] : ''}`}>
26
31
  {header}
27
32
  </span>
28
33
  )
@@ -0,0 +1,15 @@
1
+ .green > circle,
2
+ .green > rect,
3
+ .green > path {
4
+ @apply stroke-main-green;
5
+ }
6
+ .red > circle,
7
+ .red > rect,
8
+ .red > path {
9
+ @apply stroke-error-red;
10
+ }
11
+ .white > circle,
12
+ .white > rect,
13
+ .white > path {
14
+ @apply stroke-white;
15
+ }
@@ -0,0 +1,52 @@
1
+ import * as React from 'react'
2
+ import styles from './Icons.module.css'
3
+ const MetricsIcon = ({ color = 'white' }) => {
4
+ const className = styles[`${color}`]
5
+ return (
6
+ <svg
7
+ width={40}
8
+ height={40}
9
+ viewBox='0 0 40 40'
10
+ fill='none'
11
+ xmlns='http://www.w3.org/2000/svg'
12
+ className={className}
13
+ >
14
+ <rect
15
+ x={10}
16
+ y={12.5}
17
+ width={5}
18
+ height={17.5}
19
+ rx={0.5}
20
+ stroke='none'
21
+ strokeWidth={2}
22
+ />
23
+ <rect
24
+ x={20}
25
+ y={20}
26
+ width={5}
27
+ height={10}
28
+ rx={0.5}
29
+ stroke='none'
30
+ strokeWidth={2}
31
+ />
32
+ <rect
33
+ x={30}
34
+ y={5}
35
+ width={5}
36
+ height={25}
37
+ rx={0.5}
38
+ stroke='none'
39
+ strokeWidth={2}
40
+ />
41
+ <path
42
+ d='M5 5V35H35'
43
+ stroke='none'
44
+ strokeWidth={2}
45
+ strokeLinecap='round'
46
+ strokeLinejoin='round'
47
+ />
48
+ </svg>
49
+ )
50
+ }
51
+
52
+ export default MetricsIcon
@@ -1,31 +1,35 @@
1
1
  import * as React from 'react'
2
-
3
- const PullRequestIcon = () => (
4
- <svg
5
- width={40}
6
- height={40}
7
- fill='none'
8
- xmlns='http://www.w3.org/2000/svg'
9
- >
10
- <circle cx={9.5} cy={30.5} r={4.5} stroke='#fff' strokeWidth={2} />
11
- <circle cx={9.5} cy={9.5} r={4.5} stroke='#fff' strokeWidth={2} />
12
- <path stroke='#fff' strokeWidth={2} d='M9 14v12' />
13
- <circle cx={30.5} cy={30.5} r={4.5} stroke='#fff' strokeWidth={2} />
14
- <path
15
- d='M30.5 26V10.5a1 1 0 0 0-1-1H23'
16
- stroke='#fff'
17
- strokeWidth={2}
18
- strokeLinecap='round'
19
- strokeLinejoin='round'
20
- />
21
- <path
22
- d='m26 5-4.5 4.5L26 14'
23
- stroke='#fff'
24
- strokeWidth={2}
25
- strokeLinecap='round'
26
- strokeLinejoin='round'
27
- />
28
- </svg>
29
- )
2
+ import styles from './Icons.module.css'
3
+ const PullRequestIcon = ({ color = 'white' }) => {
4
+ const className = styles[`${color}`]
5
+ return (
6
+ <svg
7
+ width={40}
8
+ height={40}
9
+ fill='none'
10
+ xmlns='http://www.w3.org/2000/svg'
11
+ className={className}
12
+ >
13
+ <circle cx={9.5} cy={30.5} r={4.5} stroke='none' strokeWidth={2} />
14
+ <circle cx={9.5} cy={9.5} r={4.5} stroke='none' strokeWidth={2} />
15
+ <path stroke='none' strokeWidth={2} d='M9 14v12' />
16
+ <circle cx={30.5} cy={30.5} r={4.5} stroke='none' strokeWidth={2} />
17
+ <path
18
+ d='M30.5 26V10.5a1 1 0 0 0-1-1H23'
19
+ stroke='none'
20
+ strokeWidth={2}
21
+ strokeLinecap='round'
22
+ strokeLinejoin='round'
23
+ />
24
+ <path
25
+ d='m26 5-4.5 4.5L26 14'
26
+ stroke='none'
27
+ strokeWidth={2}
28
+ strokeLinecap='round'
29
+ strokeLinejoin='round'
30
+ />
31
+ </svg>
32
+ )
33
+ }
30
34
 
31
35
  export default PullRequestIcon
@@ -4,8 +4,9 @@ import ApiEmptyIcon from './ApiEmptyIcon'
4
4
  import CloseModalIcon from './CloseModalIcon'
5
5
  import CloseModalGreenIcon from './CloseModalGreenIcon'
6
6
  import CloseModalGreenHoverIcon from './CloseModalGreenHoverIcon'
7
+ import MetricsIcon from './MetricsIcon'
7
8
  import PullRequestIcon from './PullRequestIcon'
8
9
 
9
10
  export default {
10
- ApiIcon, ApiIconClosed, ApiEmptyIcon, CloseModalIcon, CloseModalGreenIcon, CloseModalGreenHoverIcon, PullRequestIcon
11
+ ApiIcon, ApiIconClosed, ApiEmptyIcon, CloseModalIcon, CloseModalGreenIcon, CloseModalGreenHoverIcon, MetricsIcon, PullRequestIcon
11
12
  }
@@ -0,0 +1,20 @@
1
+ import React from 'react'
2
+ import PullRequestIcon from '../../components/icons/PullRequestIcon'
3
+
4
+ export default {
5
+ title: 'Platformatic/Icons',
6
+ component: PullRequestIcon,
7
+ argTypes: {
8
+ color: {
9
+ type: 'string',
10
+ control: {
11
+ type: 'radio',
12
+ options: ['green', 'white', 'red']
13
+ }
14
+ }
15
+ }
16
+ }
17
+
18
+ const Template = (args) => <PullRequestIcon {...args} />
19
+ export const PullRequestIconDefault = Template.bind({})
20
+ PullRequestIconDefault.args = {}