@platformatic/ui-components 0.1.48 → 0.1.50
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/.github/workflows/ci.yml +26 -26
- package/.nvmrc +1 -1
- package/LICENSE +201 -201
- package/README.md +30 -30
- package/fonts/Montserrat/README.txt +81 -81
- package/index.html +12 -12
- package/index.js +71 -71
- package/package.json +76 -76
- package/postcss.config.cjs +8 -8
- package/public/api-icon-closed.svg +6 -6
- package/public/api-icon.svg +9 -9
- package/src/App.jsx +12 -12
- package/src/components/BorderedBox.jsx +18 -18
- package/src/components/BorderedBox.module.css +8 -8
- package/src/components/BorderedText.jsx +8 -8
- package/src/components/BorderedText.module.css +2 -2
- package/src/components/Box.jsx +14 -14
- package/src/components/Box.module.css +7 -7
- package/src/components/Button.jsx +95 -95
- package/src/components/Button.module.css +127 -127
- package/src/components/ButtonFullRounded.jsx +17 -17
- package/src/components/ButtonFullRounded.module.css +28 -28
- package/src/components/Checkbox.jsx +11 -11
- package/src/components/Checkbox.module.css +18 -18
- package/src/components/Common.module.css +28 -28
- package/src/components/DetailedMetric.jsx +32 -32
- package/src/components/DetailedMetric.module.css +2 -2
- package/src/components/DropDown.jsx +36 -36
- package/src/components/DropDown.module.css +27 -27
- package/src/components/FollowUs.jsx +35 -35
- package/src/components/FollowUs.module.css +11 -11
- package/src/components/GHLoginButton.jsx +14 -14
- package/src/components/HorizontalSeparator.jsx +15 -15
- package/src/components/HorizontalSeparator.module.css +26 -26
- package/src/components/InfoBox.jsx +50 -50
- package/src/components/InfoBox.module.css +5 -5
- package/src/components/List.jsx +20 -20
- package/src/components/List.module.css +11 -11
- package/src/components/ListElement.jsx +23 -23
- package/src/components/ListElement.module.css +23 -23
- package/src/components/Loadable.jsx +34 -34
- package/src/components/Loadable.module.css +13 -13
- package/src/components/Loader.jsx +22 -22
- package/src/components/Loader.module.css +13 -13
- package/src/components/LoginButton.jsx +17 -17
- package/src/components/LoginButton.module.css +7 -7
- package/src/components/LoginButton.test.jsx +25 -25
- package/src/components/Logo.jsx +62 -62
- package/src/components/Logo.module.css +5 -5
- package/src/components/Main.jsx +33 -33
- package/src/components/MetricValue.jsx +15 -15
- package/src/components/MetricValue.module.css +9 -9
- package/src/components/Modal.jsx +93 -93
- package/src/components/Modal.module.css +50 -50
- package/src/components/PlatformaticIcon.jsx +57 -57
- package/src/components/PlatformaticIcon.module.css +2 -2
- package/src/components/Playground.jsx +9 -9
- package/src/components/SearchBar.jsx +63 -63
- package/src/components/SearchBar.module.css +20 -20
- package/src/components/Sidebar.jsx +153 -153
- package/src/components/Sidebar.module.css +66 -66
- package/src/components/SimpleMetric.jsx +28 -28
- package/src/components/SimpleMetric.module.css +6 -6
- package/src/components/Status.jsx +26 -26
- package/src/components/TabbedWindow.jsx +39 -39
- package/src/components/TabbedWindow.module.css +16 -16
- package/src/components/TextWithLabel.jsx +11 -11
- package/src/components/TextWithLabel.module.css +8 -8
- package/src/components/Versions.jsx +9 -9
- package/src/components/VerticalSeparator.jsx +5 -5
- package/src/components/forms/Field.jsx +53 -20
- package/src/components/forms/Field.module.css +23 -17
- package/src/components/forms/Input.jsx +80 -87
- package/src/components/forms/Input.module.css +28 -28
- package/src/components/forms/Preview.jsx +75 -77
- package/src/components/forms/Preview.module.css +14 -14
- package/src/components/forms/ToggleSwitch.jsx +18 -18
- package/src/components/forms/ToggleSwitch.module.css +42 -42
- package/src/components/forms/index.js +8 -8
- package/src/components/icons/ApiEmptyIcon.jsx +107 -107
- package/src/components/icons/ApiIcon.jsx +29 -29
- package/src/components/icons/ApiIconClosed.jsx +19 -19
- package/src/components/icons/AppEmptyIcon.jsx +94 -94
- package/src/components/icons/AppIcon.jsx +38 -38
- package/src/components/icons/AppListIcon.jsx +73 -73
- package/src/components/icons/Calendar1Icon.jsx +54 -54
- package/src/components/icons/Calendar7Icon.jsx +55 -55
- package/src/components/icons/CalendarIcon.jsx +56 -56
- package/src/components/icons/CircleAddIcon.jsx +40 -40
- package/src/components/icons/CircleBackIcon.jsx +51 -51
- package/src/components/icons/CircleCheckMarkIcon.jsx +66 -0
- package/src/components/icons/CircleCloseHoverIcon.jsx +42 -42
- package/src/components/icons/CircleCloseIcon.jsx +32 -32
- package/src/components/icons/CircleExclamationIcon.jsx +29 -29
- package/src/components/icons/CloseIcon.jsx +31 -31
- package/src/components/icons/CopyIcon.jsx +75 -46
- package/src/components/icons/CreatedWorkspaceIcon.jsx +70 -70
- package/src/components/icons/DynamicWorkspaceIcon.jsx +125 -125
- package/src/components/icons/EditIcon.jsx +38 -0
- package/src/components/icons/GearIcon.jsx +40 -40
- package/src/components/icons/Icons.module.css +29 -29
- package/src/components/icons/LiveIcon.jsx +43 -43
- package/src/components/icons/MetricsIcon.jsx +52 -52
- package/src/components/icons/PlayIcon.jsx +20 -20
- package/src/components/icons/PullRequestIcon.jsx +35 -35
- package/src/components/icons/StaticWorkspaceIcon.jsx +119 -119
- package/src/components/icons/StopIcon.jsx +21 -21
- package/src/components/icons/TerminalIcon.jsx +22 -22
- package/src/components/icons/TriangleExclamationIcon.jsx +26 -26
- package/src/components/icons/UpgradeIcon.jsx +48 -48
- package/src/components/icons/index.js +63 -59
- package/src/components/layouts/Layout.jsx +11 -11
- package/src/components/layouts/TwoColumnsLayout.jsx +12 -12
- package/src/components/layouts/TwoColumnsLayout.module.css +9 -9
- package/src/hooks/useEscapeKey.js +20 -20
- package/src/lib/utils.js +23 -23
- package/src/main.jsx +9 -9
- package/src/stories/BorderedBox.stories.jsx +33 -33
- package/src/stories/BorderedText.stories.jsx +24 -24
- package/src/stories/Button.stories.jsx +114 -114
- package/src/stories/ButtonFullRounded.stories.jsx +61 -61
- package/src/stories/Checkbox.stories.jsx +27 -27
- package/src/stories/DetailedMetric.stories.jsx +33 -33
- package/src/stories/DropDown.stories.jsx +62 -62
- package/src/stories/FollowUs.stories.jsx +14 -14
- package/src/stories/GHLoginButton.stories.jsx +14 -14
- package/src/stories/HorizontalSeparator.stories.jsx +12 -12
- package/src/stories/InfoBox.stories.jsx +46 -46
- package/src/stories/Introduction.stories.mdx +211 -211
- package/src/stories/List.stories.jsx +29 -29
- package/src/stories/ListElement.stories.jsx +15 -15
- package/src/stories/Loadable.stories.jsx +75 -75
- package/src/stories/Loader.stories.jsx +44 -44
- package/src/stories/LoginButton.stories.jsx +15 -15
- package/src/stories/Logo.stories.jsx +17 -17
- package/src/stories/Modal.stories.jsx +100 -100
- package/src/stories/PlatformaticIcon.stories.jsx +51 -35
- package/src/stories/SearchBar.stories.jsx +28 -28
- package/src/stories/Sidebar.stories.jsx +61 -61
- package/src/stories/SimpleMetric.stories.jsx +41 -41
- package/src/stories/Status.stories.jsx +31 -31
- package/src/stories/TextWithLabel.stories.jsx +25 -25
- package/src/stories/TwoColumnsLayout.stories.jsx +42 -42
- package/src/stories/forms/Field.stories.jsx +89 -81
- package/src/stories/forms/Input.stories.jsx +89 -69
- package/src/stories/forms/Preview.stories.jsx +57 -57
- package/src/stories/forms/ToggleSwitch.stories.jsx +15 -15
- package/src/stories/icons/Icons.stories.jsx +74 -74
- package/src/styles/main.css +15 -15
- package/tailwind.config.cjs +60 -60
- package/vite.config.js +6 -6
- package/vitest.config.js +14 -14
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import Icons from './icons'
|
|
3
|
-
import styles from './Sidebar.module.css'
|
|
4
|
-
import ReactTooltip from 'react-tooltip'
|
|
5
|
-
import HorizontalSeparator from './HorizontalSeparator'
|
|
6
|
-
import PlatformaticIcon from './PlatformaticIcon'
|
|
7
|
-
import PropTypes from 'prop-types'
|
|
8
|
-
|
|
9
|
-
function Sidebar (props) {
|
|
10
|
-
const {
|
|
11
|
-
title,
|
|
12
|
-
defaultSelected,
|
|
13
|
-
onClickItemSelectedParent,
|
|
14
|
-
items,
|
|
15
|
-
onClickAdd,
|
|
16
|
-
addTitle,
|
|
17
|
-
onClickSettings
|
|
18
|
-
} = props
|
|
19
|
-
const [collapsed, setCollapsed] = useState(false)
|
|
20
|
-
const [selectedItem, setSelectedItem] = useState(defaultSelected)
|
|
21
|
-
|
|
22
|
-
function onClickItemSelected (index) {
|
|
23
|
-
setSelectedItem(index)
|
|
24
|
-
onClickItemSelectedParent(index)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div className={`${styles.container} ${collapsed && styles.collapsed}`}>
|
|
29
|
-
{collapsed
|
|
30
|
-
? (
|
|
31
|
-
<>
|
|
32
|
-
<button type='button' className={styles.buttonExpand} onClick={() => { setCollapsed(false) }}>
|
|
33
|
-
<Icons.StaticWorkspaceIcon color='white' />
|
|
34
|
-
</button>
|
|
35
|
-
<div className={styles.titleCollapsed} data-testid='lateral-bar-title'>
|
|
36
|
-
{title}
|
|
37
|
-
</div>
|
|
38
|
-
<HorizontalSeparator marginBottom={2} marginTop={2} />
|
|
39
|
-
<div className={styles.bottom}>
|
|
40
|
-
<button type='button' className={styles.buttonSettings} onClick={onClickSettings}>
|
|
41
|
-
<Icons.GearIcon color='white' />
|
|
42
|
-
</button>
|
|
43
|
-
<div className={styles.titleCollapsed} data-testid='lateral-bar-title'>
|
|
44
|
-
Settings
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</>
|
|
48
|
-
)
|
|
49
|
-
: (
|
|
50
|
-
<>
|
|
51
|
-
<button type='button' className={styles.buttonCollapse} onClick={() => { setCollapsed(true) }}>
|
|
52
|
-
<PlatformaticIcon
|
|
53
|
-
iconName='CircleBackIcon'
|
|
54
|
-
color='white'
|
|
55
|
-
size='normal'
|
|
56
|
-
/>
|
|
57
|
-
</button>
|
|
58
|
-
<div className={styles.title} data-testid='lateral-bar-title'>
|
|
59
|
-
{title}
|
|
60
|
-
</div>
|
|
61
|
-
<div className={styles.items} data-test-id='lateral-bar-items'>
|
|
62
|
-
{items.map((item, index) => {
|
|
63
|
-
const isSelected = selectedItem === index
|
|
64
|
-
return (
|
|
65
|
-
<React.Fragment key={index}>
|
|
66
|
-
<button className={`${styles.buttonItem} ${collapsed && styles.buttonItemCollapsed}`} type='button' onClick={() => onClickItemSelected(index)}>
|
|
67
|
-
{item.iconName && (<PlatformaticIcon
|
|
68
|
-
iconName={item.iconName}
|
|
69
|
-
color={isSelected ? 'green' : 'white'}
|
|
70
|
-
tip={item.title}
|
|
71
|
-
/>)}
|
|
72
|
-
<div className={`${styles.item} ${isSelected ? styles.itemSelected : ''}`}>
|
|
73
|
-
<span className={styles.itemSubTitle}>{item.subTitle}</span>
|
|
74
|
-
<span className={styles.itemTitle}>{item.title}</span>
|
|
75
|
-
</div>
|
|
76
|
-
</button>
|
|
77
|
-
<ReactTooltip />
|
|
78
|
-
</React.Fragment>
|
|
79
|
-
)
|
|
80
|
-
})}
|
|
81
|
-
{/* <Button label='Add' buttonClass='transparent' icon={faPlus} color='white' size='small' inClick={onClickAdd}/> */}
|
|
82
|
-
<button className={`${styles.buttonItem} ${collapsed && styles.buttonItemCollapsed}`} onClick={onClickAdd}>
|
|
83
|
-
<PlatformaticIcon
|
|
84
|
-
iconName='CircleAddIcon'
|
|
85
|
-
color='white'
|
|
86
|
-
tip={addTitle}
|
|
87
|
-
/>
|
|
88
|
-
{!collapsed && <span className={styles.item}>{addTitle}</span>}
|
|
89
|
-
</button>
|
|
90
|
-
</div>
|
|
91
|
-
<HorizontalSeparator marginBottom='2' marginTop='2' />
|
|
92
|
-
|
|
93
|
-
<div className={styles.bottom}>
|
|
94
|
-
<button type='button' className={`${styles.buttonSettings} ${styles.buttonSettingsExpanded}`} onClick={onClickSettings}>
|
|
95
|
-
<Icons.GearIcon color='white' size='small' /> <span className={styles.titleSettings}>Settings</span>
|
|
96
|
-
</button>
|
|
97
|
-
</div>
|
|
98
|
-
</>
|
|
99
|
-
)}
|
|
100
|
-
</div>
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
Sidebar.propTypes = {
|
|
105
|
-
/**
|
|
106
|
-
* title
|
|
107
|
-
*/
|
|
108
|
-
title: PropTypes.string,
|
|
109
|
-
/**
|
|
110
|
-
* defaultSelected
|
|
111
|
-
*/
|
|
112
|
-
defaultSelected: PropTypes.number,
|
|
113
|
-
/**
|
|
114
|
-
* addTitle
|
|
115
|
-
*/
|
|
116
|
-
addTitle: PropTypes.string,
|
|
117
|
-
/**
|
|
118
|
-
* items: array with keys
|
|
119
|
-
* title: name to display
|
|
120
|
-
* subtitle: secondary title
|
|
121
|
-
* icon: what Icon
|
|
122
|
-
*/
|
|
123
|
-
items: PropTypes.arrayOf(PropTypes.shape({
|
|
124
|
-
title: PropTypes.string,
|
|
125
|
-
subtitle: PropTypes.string,
|
|
126
|
-
iconName: PropTypes.string
|
|
127
|
-
})),
|
|
128
|
-
/**
|
|
129
|
-
* Apply onClickItemSelectedParent
|
|
130
|
-
*/
|
|
131
|
-
onClickItemSelectedParent: PropTypes.func,
|
|
132
|
-
/**
|
|
133
|
-
* Apply onClickAdd: function called clicking on plus button
|
|
134
|
-
*/
|
|
135
|
-
onClickAdd: PropTypes.func,
|
|
136
|
-
/**
|
|
137
|
-
* Apply onClickSettings: function called clicking on Settings button
|
|
138
|
-
*/
|
|
139
|
-
onClickSettings: PropTypes.func
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
Sidebar.defaultProps = {
|
|
144
|
-
title: '',
|
|
145
|
-
defaultSelected: 0,
|
|
146
|
-
onClickItemSelectedParent: () => {},
|
|
147
|
-
items: [],
|
|
148
|
-
onClickAdd: () => {},
|
|
149
|
-
addTitle: 'Add',
|
|
150
|
-
onClickSettings: () => {}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export default Sidebar
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import Icons from './icons'
|
|
3
|
+
import styles from './Sidebar.module.css'
|
|
4
|
+
import ReactTooltip from 'react-tooltip'
|
|
5
|
+
import HorizontalSeparator from './HorizontalSeparator'
|
|
6
|
+
import PlatformaticIcon from './PlatformaticIcon'
|
|
7
|
+
import PropTypes from 'prop-types'
|
|
8
|
+
|
|
9
|
+
function Sidebar (props) {
|
|
10
|
+
const {
|
|
11
|
+
title,
|
|
12
|
+
defaultSelected,
|
|
13
|
+
onClickItemSelectedParent,
|
|
14
|
+
items,
|
|
15
|
+
onClickAdd,
|
|
16
|
+
addTitle,
|
|
17
|
+
onClickSettings
|
|
18
|
+
} = props
|
|
19
|
+
const [collapsed, setCollapsed] = useState(false)
|
|
20
|
+
const [selectedItem, setSelectedItem] = useState(defaultSelected)
|
|
21
|
+
|
|
22
|
+
function onClickItemSelected (index) {
|
|
23
|
+
setSelectedItem(index)
|
|
24
|
+
onClickItemSelectedParent(index)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div className={`${styles.container} ${collapsed && styles.collapsed}`}>
|
|
29
|
+
{collapsed
|
|
30
|
+
? (
|
|
31
|
+
<>
|
|
32
|
+
<button type='button' className={styles.buttonExpand} onClick={() => { setCollapsed(false) }}>
|
|
33
|
+
<Icons.StaticWorkspaceIcon color='white' />
|
|
34
|
+
</button>
|
|
35
|
+
<div className={styles.titleCollapsed} data-testid='lateral-bar-title'>
|
|
36
|
+
{title}
|
|
37
|
+
</div>
|
|
38
|
+
<HorizontalSeparator marginBottom={2} marginTop={2} />
|
|
39
|
+
<div className={styles.bottom}>
|
|
40
|
+
<button type='button' className={styles.buttonSettings} onClick={onClickSettings}>
|
|
41
|
+
<Icons.GearIcon color='white' />
|
|
42
|
+
</button>
|
|
43
|
+
<div className={styles.titleCollapsed} data-testid='lateral-bar-title'>
|
|
44
|
+
Settings
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</>
|
|
48
|
+
)
|
|
49
|
+
: (
|
|
50
|
+
<>
|
|
51
|
+
<button type='button' className={styles.buttonCollapse} onClick={() => { setCollapsed(true) }}>
|
|
52
|
+
<PlatformaticIcon
|
|
53
|
+
iconName='CircleBackIcon'
|
|
54
|
+
color='white'
|
|
55
|
+
size='normal'
|
|
56
|
+
/>
|
|
57
|
+
</button>
|
|
58
|
+
<div className={styles.title} data-testid='lateral-bar-title'>
|
|
59
|
+
{title}
|
|
60
|
+
</div>
|
|
61
|
+
<div className={styles.items} data-test-id='lateral-bar-items'>
|
|
62
|
+
{items.map((item, index) => {
|
|
63
|
+
const isSelected = selectedItem === index
|
|
64
|
+
return (
|
|
65
|
+
<React.Fragment key={index}>
|
|
66
|
+
<button className={`${styles.buttonItem} ${collapsed && styles.buttonItemCollapsed}`} type='button' onClick={() => onClickItemSelected(index)}>
|
|
67
|
+
{item.iconName && (<PlatformaticIcon
|
|
68
|
+
iconName={item.iconName}
|
|
69
|
+
color={isSelected ? 'green' : 'white'}
|
|
70
|
+
tip={item.title}
|
|
71
|
+
/>)}
|
|
72
|
+
<div className={`${styles.item} ${isSelected ? styles.itemSelected : ''}`}>
|
|
73
|
+
<span className={styles.itemSubTitle}>{item.subTitle}</span>
|
|
74
|
+
<span className={styles.itemTitle}>{item.title}</span>
|
|
75
|
+
</div>
|
|
76
|
+
</button>
|
|
77
|
+
<ReactTooltip />
|
|
78
|
+
</React.Fragment>
|
|
79
|
+
)
|
|
80
|
+
})}
|
|
81
|
+
{/* <Button label='Add' buttonClass='transparent' icon={faPlus} color='white' size='small' inClick={onClickAdd}/> */}
|
|
82
|
+
<button className={`${styles.buttonItem} ${collapsed && styles.buttonItemCollapsed}`} onClick={onClickAdd}>
|
|
83
|
+
<PlatformaticIcon
|
|
84
|
+
iconName='CircleAddIcon'
|
|
85
|
+
color='white'
|
|
86
|
+
tip={addTitle}
|
|
87
|
+
/>
|
|
88
|
+
{!collapsed && <span className={styles.item}>{addTitle}</span>}
|
|
89
|
+
</button>
|
|
90
|
+
</div>
|
|
91
|
+
<HorizontalSeparator marginBottom='2' marginTop='2' />
|
|
92
|
+
|
|
93
|
+
<div className={styles.bottom}>
|
|
94
|
+
<button type='button' className={`${styles.buttonSettings} ${styles.buttonSettingsExpanded}`} onClick={onClickSettings}>
|
|
95
|
+
<Icons.GearIcon color='white' size='small' /> <span className={styles.titleSettings}>Settings</span>
|
|
96
|
+
</button>
|
|
97
|
+
</div>
|
|
98
|
+
</>
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
Sidebar.propTypes = {
|
|
105
|
+
/**
|
|
106
|
+
* title
|
|
107
|
+
*/
|
|
108
|
+
title: PropTypes.string,
|
|
109
|
+
/**
|
|
110
|
+
* defaultSelected
|
|
111
|
+
*/
|
|
112
|
+
defaultSelected: PropTypes.number,
|
|
113
|
+
/**
|
|
114
|
+
* addTitle
|
|
115
|
+
*/
|
|
116
|
+
addTitle: PropTypes.string,
|
|
117
|
+
/**
|
|
118
|
+
* items: array with keys
|
|
119
|
+
* title: name to display
|
|
120
|
+
* subtitle: secondary title
|
|
121
|
+
* icon: what Icon
|
|
122
|
+
*/
|
|
123
|
+
items: PropTypes.arrayOf(PropTypes.shape({
|
|
124
|
+
title: PropTypes.string,
|
|
125
|
+
subtitle: PropTypes.string,
|
|
126
|
+
iconName: PropTypes.string
|
|
127
|
+
})),
|
|
128
|
+
/**
|
|
129
|
+
* Apply onClickItemSelectedParent
|
|
130
|
+
*/
|
|
131
|
+
onClickItemSelectedParent: PropTypes.func,
|
|
132
|
+
/**
|
|
133
|
+
* Apply onClickAdd: function called clicking on plus button
|
|
134
|
+
*/
|
|
135
|
+
onClickAdd: PropTypes.func,
|
|
136
|
+
/**
|
|
137
|
+
* Apply onClickSettings: function called clicking on Settings button
|
|
138
|
+
*/
|
|
139
|
+
onClickSettings: PropTypes.func
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
Sidebar.defaultProps = {
|
|
144
|
+
title: '',
|
|
145
|
+
defaultSelected: 0,
|
|
146
|
+
onClickItemSelectedParent: () => {},
|
|
147
|
+
items: [],
|
|
148
|
+
onClickAdd: () => {},
|
|
149
|
+
addTitle: 'Add',
|
|
150
|
+
onClickSettings: () => {}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export default Sidebar
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
@apply max-w-[216px] w-full p-4 border border-white rounded-md h-auto relative min-h-[80vh];
|
|
3
|
-
transition: max-width 0.2s linear;
|
|
4
|
-
}
|
|
5
|
-
.collapsed {
|
|
6
|
-
@apply max-w-[96px] text-center;
|
|
7
|
-
}
|
|
8
|
-
.buttonExpand {
|
|
9
|
-
@apply border rounded-md p-1 border-white;
|
|
10
|
-
}
|
|
11
|
-
.buttonSettings {
|
|
12
|
-
@apply border rounded-md p-1 border-white;
|
|
13
|
-
}
|
|
14
|
-
.buttonCollapse {
|
|
15
|
-
@apply absolute border-0 rounded-full right-[-0.875rem];
|
|
16
|
-
/* Override tailwind dist button[type='button]: background: transparent*/
|
|
17
|
-
@apply bg-main-dark-blue !important;
|
|
18
|
-
top: 1rem;
|
|
19
|
-
}
|
|
20
|
-
.title {
|
|
21
|
-
@apply text-white font-bold py-3;
|
|
22
|
-
}
|
|
23
|
-
.titleCollapsed {
|
|
24
|
-
@apply text-white text-[10px];
|
|
25
|
-
}
|
|
26
|
-
.buttonItem {
|
|
27
|
-
@apply flex items-center justify-start border-0 w-full;
|
|
28
|
-
}
|
|
29
|
-
.buttonItemCollapsed {
|
|
30
|
-
@apply w-auto;
|
|
31
|
-
}
|
|
32
|
-
.item {
|
|
33
|
-
@apply text-white ml-2 grow-0 text-left flex flex-col;
|
|
34
|
-
width: calc(100% - 28px)
|
|
35
|
-
}
|
|
36
|
-
.itemSubTitle {
|
|
37
|
-
@apply text-[10px] leading-[10px];
|
|
38
|
-
}
|
|
39
|
-
.itemTitle{
|
|
40
|
-
@apply text-xs text-ellipsis overflow-hidden whitespace-nowrap;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.itemSelected {
|
|
44
|
-
@apply text-light-green;
|
|
45
|
-
}
|
|
46
|
-
.items {
|
|
47
|
-
@apply flex flex-col gap-y-3 py-2;
|
|
48
|
-
}
|
|
49
|
-
.bottom {
|
|
50
|
-
@apply absolute left-0 bottom-[1rem] w-full px-4;
|
|
51
|
-
}
|
|
52
|
-
.titleSettings {
|
|
53
|
-
@apply text-white font-semibold ml-3;
|
|
54
|
-
}
|
|
55
|
-
.buttonSettingsExpanded {
|
|
56
|
-
@apply flex items-center justify-center w-full;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@keyframes fadeIn {
|
|
60
|
-
0% {
|
|
61
|
-
opacity: 0;
|
|
62
|
-
}
|
|
63
|
-
100% {
|
|
64
|
-
opacity: 1;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
.container {
|
|
2
|
+
@apply max-w-[216px] w-full p-4 border border-white rounded-md h-auto relative min-h-[80vh];
|
|
3
|
+
transition: max-width 0.2s linear;
|
|
4
|
+
}
|
|
5
|
+
.collapsed {
|
|
6
|
+
@apply max-w-[96px] text-center;
|
|
7
|
+
}
|
|
8
|
+
.buttonExpand {
|
|
9
|
+
@apply border rounded-md p-1 border-white;
|
|
10
|
+
}
|
|
11
|
+
.buttonSettings {
|
|
12
|
+
@apply border rounded-md p-1 border-white;
|
|
13
|
+
}
|
|
14
|
+
.buttonCollapse {
|
|
15
|
+
@apply absolute border-0 rounded-full right-[-0.875rem];
|
|
16
|
+
/* Override tailwind dist button[type='button]: background: transparent*/
|
|
17
|
+
@apply bg-main-dark-blue !important;
|
|
18
|
+
top: 1rem;
|
|
19
|
+
}
|
|
20
|
+
.title {
|
|
21
|
+
@apply text-white font-bold py-3;
|
|
22
|
+
}
|
|
23
|
+
.titleCollapsed {
|
|
24
|
+
@apply text-white text-[10px];
|
|
25
|
+
}
|
|
26
|
+
.buttonItem {
|
|
27
|
+
@apply flex items-center justify-start border-0 w-full;
|
|
28
|
+
}
|
|
29
|
+
.buttonItemCollapsed {
|
|
30
|
+
@apply w-auto;
|
|
31
|
+
}
|
|
32
|
+
.item {
|
|
33
|
+
@apply text-white ml-2 grow-0 text-left flex flex-col;
|
|
34
|
+
width: calc(100% - 28px)
|
|
35
|
+
}
|
|
36
|
+
.itemSubTitle {
|
|
37
|
+
@apply text-[10px] leading-[10px];
|
|
38
|
+
}
|
|
39
|
+
.itemTitle{
|
|
40
|
+
@apply text-xs text-ellipsis overflow-hidden whitespace-nowrap;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.itemSelected {
|
|
44
|
+
@apply text-light-green;
|
|
45
|
+
}
|
|
46
|
+
.items {
|
|
47
|
+
@apply flex flex-col gap-y-3 py-2;
|
|
48
|
+
}
|
|
49
|
+
.bottom {
|
|
50
|
+
@apply absolute left-0 bottom-[1rem] w-full px-4;
|
|
51
|
+
}
|
|
52
|
+
.titleSettings {
|
|
53
|
+
@apply text-white font-semibold ml-3;
|
|
54
|
+
}
|
|
55
|
+
.buttonSettingsExpanded {
|
|
56
|
+
@apply flex items-center justify-center w-full;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@keyframes fadeIn {
|
|
60
|
+
0% {
|
|
61
|
+
opacity: 0;
|
|
62
|
+
}
|
|
63
|
+
100% {
|
|
64
|
+
opacity: 1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
// The icon that is in design is not in the free version of fontawesome
|
|
5
|
-
// Temporary using this one
|
|
6
|
-
import ReactTooltip from 'react-tooltip'
|
|
7
|
-
import BorderedBox from './BorderedBox'
|
|
8
|
-
import styles from './SimpleMetric.module.css'
|
|
9
|
-
import MetricValue from './MetricValue'
|
|
10
|
-
import Icons from './icons'
|
|
11
|
-
|
|
12
|
-
export default function SimpleMetric ({ title, pre, color, unit, value, tooltip, children }) {
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
<BorderedBox>
|
|
16
|
-
<div className={styles.header}>
|
|
17
|
-
<span className={styles.title}>{title}</span>
|
|
18
|
-
<Icons.CircleExclamationIcon tip={tooltip} />
|
|
19
|
-
</div>
|
|
20
|
-
<div>
|
|
21
|
-
<MetricValue pre={pre} color={color} unit={unit} value={value} />
|
|
22
|
-
{children}
|
|
23
|
-
</div>
|
|
24
|
-
</BorderedBox>
|
|
25
|
-
<ReactTooltip />
|
|
26
|
-
</>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import React from 'react'
|
|
4
|
+
// The icon that is in design is not in the free version of fontawesome
|
|
5
|
+
// Temporary using this one
|
|
6
|
+
import ReactTooltip from 'react-tooltip'
|
|
7
|
+
import BorderedBox from './BorderedBox'
|
|
8
|
+
import styles from './SimpleMetric.module.css'
|
|
9
|
+
import MetricValue from './MetricValue'
|
|
10
|
+
import Icons from './icons'
|
|
11
|
+
|
|
12
|
+
export default function SimpleMetric ({ title, pre, color, unit, value, tooltip, children }) {
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<BorderedBox>
|
|
16
|
+
<div className={styles.header}>
|
|
17
|
+
<span className={styles.title}>{title}</span>
|
|
18
|
+
<Icons.CircleExclamationIcon tip={tooltip} />
|
|
19
|
+
</div>
|
|
20
|
+
<div>
|
|
21
|
+
<MetricValue pre={pre} color={color} unit={unit} value={value} />
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
</BorderedBox>
|
|
25
|
+
<ReactTooltip />
|
|
26
|
+
</>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
.header {
|
|
2
|
-
@apply flex justify-between items-center font-bold;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.title {
|
|
6
|
-
@apply text-base font-semibold;
|
|
1
|
+
.header {
|
|
2
|
+
@apply flex justify-between items-center font-bold;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.title {
|
|
6
|
+
@apply text-base font-semibold;
|
|
7
7
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
4
|
-
import { faCircle } from '@fortawesome/free-solid-svg-icons'
|
|
5
|
-
export default function Status (props) {
|
|
6
|
-
const { color, status } = props
|
|
7
|
-
|
|
8
|
-
function getColorClass (color) {
|
|
9
|
-
switch (color) {
|
|
10
|
-
case 'green':
|
|
11
|
-
return 'text-main-green'
|
|
12
|
-
case 'red':
|
|
13
|
-
return 'text-error-red'
|
|
14
|
-
case 'white':
|
|
15
|
-
default:
|
|
16
|
-
return 'text-white'
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const colorClass = getColorClass(color)
|
|
20
|
-
return (
|
|
21
|
-
<div className={colorClass}>
|
|
22
|
-
<FontAwesomeIcon icon={faCircle} size='2xs' className={`text-${colorClass} mr-2`} />
|
|
23
|
-
{status}
|
|
24
|
-
</div>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
4
|
+
import { faCircle } from '@fortawesome/free-solid-svg-icons'
|
|
5
|
+
export default function Status (props) {
|
|
6
|
+
const { color, status } = props
|
|
7
|
+
|
|
8
|
+
function getColorClass (color) {
|
|
9
|
+
switch (color) {
|
|
10
|
+
case 'green':
|
|
11
|
+
return 'text-main-green'
|
|
12
|
+
case 'red':
|
|
13
|
+
return 'text-error-red'
|
|
14
|
+
case 'white':
|
|
15
|
+
default:
|
|
16
|
+
return 'text-white'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const colorClass = getColorClass(color)
|
|
20
|
+
return (
|
|
21
|
+
<div className={colorClass}>
|
|
22
|
+
<FontAwesomeIcon icon={faCircle} size='2xs' className={`text-${colorClass} mr-2`} />
|
|
23
|
+
{status}
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import React, { useEffect, useState } from 'react'
|
|
3
|
-
import styles from './TabbedWindow.module.css'
|
|
4
|
-
|
|
5
|
-
export default function TabbedWindow (props) {
|
|
6
|
-
const { tabs, defaultSelected = 0, callbackSelected = () => {} } = props
|
|
7
|
-
const [selected, setSelected] = useState(defaultSelected)
|
|
8
|
-
const headers = []
|
|
9
|
-
const components = []
|
|
10
|
-
tabs.forEach((tab) => {
|
|
11
|
-
headers.push(tab.label)
|
|
12
|
-
components.push(tab.component)
|
|
13
|
-
})
|
|
14
|
-
let currentComponent = components[selected]
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
currentComponent = components[selected]
|
|
18
|
-
}, [selected])
|
|
19
|
-
|
|
20
|
-
function setCurrentTab (index) {
|
|
21
|
-
setSelected(index)
|
|
22
|
-
callbackSelected(index)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div className={styles['tabbed-container']}>
|
|
27
|
-
<div className={styles['tabs-header']}>
|
|
28
|
-
{headers.map((header, index) => {
|
|
29
|
-
return (
|
|
30
|
-
<span onClick={() => setCurrentTab(index)} key={index} className={`${styles.tab} ${selected === index ? styles['selected-tab'] : ''}`}>
|
|
31
|
-
{header}
|
|
32
|
-
</span>
|
|
33
|
-
)
|
|
34
|
-
})}
|
|
35
|
-
</div>
|
|
36
|
-
<div className={styles['tabs-content']}>{currentComponent()}</div>
|
|
37
|
-
</div>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
import React, { useEffect, useState } from 'react'
|
|
3
|
+
import styles from './TabbedWindow.module.css'
|
|
4
|
+
|
|
5
|
+
export default function TabbedWindow (props) {
|
|
6
|
+
const { tabs, defaultSelected = 0, callbackSelected = () => {} } = props
|
|
7
|
+
const [selected, setSelected] = useState(defaultSelected)
|
|
8
|
+
const headers = []
|
|
9
|
+
const components = []
|
|
10
|
+
tabs.forEach((tab) => {
|
|
11
|
+
headers.push(tab.label)
|
|
12
|
+
components.push(tab.component)
|
|
13
|
+
})
|
|
14
|
+
let currentComponent = components[selected]
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
currentComponent = components[selected]
|
|
18
|
+
}, [selected])
|
|
19
|
+
|
|
20
|
+
function setCurrentTab (index) {
|
|
21
|
+
setSelected(index)
|
|
22
|
+
callbackSelected(index)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={styles['tabbed-container']}>
|
|
27
|
+
<div className={styles['tabs-header']}>
|
|
28
|
+
{headers.map((header, index) => {
|
|
29
|
+
return (
|
|
30
|
+
<span onClick={() => setCurrentTab(index)} key={index} className={`${styles.tab} ${selected === index ? styles['selected-tab'] : ''}`}>
|
|
31
|
+
{header}
|
|
32
|
+
</span>
|
|
33
|
+
)
|
|
34
|
+
})}
|
|
35
|
+
</div>
|
|
36
|
+
<div className={styles['tabs-content']}>{currentComponent()}</div>
|
|
37
|
+
</div>
|
|
38
|
+
)
|
|
39
|
+
}
|