@platformatic/ui-components 0.1.36 → 0.1.37
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 +2 -2
- package/package.json +1 -1
- package/src/components/SideBar.jsx +2 -2
- package/src/stories/SideBar.stories.jsx +13 -13
package/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import GHLoginButton from './src/components/GHLoginButton'
|
|
|
13
13
|
import HorizontalSeparator from './src/components/HorizontalSeparator'
|
|
14
14
|
import Icons from './src/components/icons'
|
|
15
15
|
import Input from './src/components/Input'
|
|
16
|
-
import
|
|
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'
|
|
@@ -44,7 +44,7 @@ export {
|
|
|
44
44
|
GHLoginButton,
|
|
45
45
|
Icons,
|
|
46
46
|
Input,
|
|
47
|
-
|
|
47
|
+
SideBar,
|
|
48
48
|
Layout,
|
|
49
49
|
List,
|
|
50
50
|
ListElement,
|
package/package.json
CHANGED
|
@@ -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 './
|
|
5
|
+
import styles from './SideBar.module.css'
|
|
6
6
|
import ReactTooltip from 'react-tooltip'
|
|
7
7
|
import HorizontalSeparator from './HorizontalSeparator'
|
|
8
|
-
export default function
|
|
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)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
import { useState } from 'react'
|
|
3
|
-
import
|
|
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/
|
|
15
|
-
component:
|
|
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) => <
|
|
26
|
+
const Template = (args) => <SideBar {...args} />
|
|
27
27
|
|
|
28
|
-
export const
|
|
28
|
+
export const EmptySideBar = Template.bind({})
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
title: '
|
|
30
|
+
EmptySideBar.args = {
|
|
31
|
+
title: 'SideBar bar empty',
|
|
32
32
|
addTitle: 'Create',
|
|
33
|
-
onClickAdd: () => alert('clicked on add
|
|
33
|
+
onClickAdd: () => alert('clicked on add EmptySideBar')
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const
|
|
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
|
-
<
|
|
45
|
+
<SideBar items={items} onClickAdd={() => onClickAdd()} {...args} />
|
|
46
46
|
)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export const
|
|
49
|
+
export const FullSideBar = FullSideBarTemplate.bind({})
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
title: '
|
|
51
|
+
FullSideBar.args = {
|
|
52
|
+
title: 'SideBar bar Full',
|
|
53
53
|
addTitle: 'Create',
|
|
54
54
|
onClickItemSelected: (index) => alert('selected: ' + index)
|
|
55
55
|
}
|