Skip to content

Commit a8820d4

Browse files
committed
Add sidebar with layout
1 parent 69f14a0 commit a8820d4

File tree

7 files changed

+34
-14
lines changed

7 files changed

+34
-14
lines changed

dash_mp_components/MatSidebar.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ class MatSidebar(Component):
1010
Keyword arguments:
1111
- id (string; optional): The ID used to identify this component in Dash callbacks.
1212
- currentApp (string; optional)
13-
- state (dict; optional)"""
13+
- state (string; optional)
14+
- layout (a value equal to: 'vertical', 'horizontal'; optional)"""
1415
@_explicitize_args
1516
def __init__(self,
1617
id=Component.UNDEFINED,
1718
currentApp=Component.UNDEFINED,
1819
state=Component.UNDEFINED,
20+
layout=Component.UNDEFINED,
1921
**kwargs):
20-
self._prop_names = ['id', 'currentApp', 'state']
22+
self._prop_names = ['id', 'currentApp', 'state', 'layout']
2123
self._type = 'MatSidebar'
2224
self._namespace = 'dash_mp_components'
2325
self._valid_wildcard_attributes = []
24-
self.available_properties = ['id', 'currentApp', 'state']
26+
self.available_properties = ['id', 'currentApp', 'state', 'layout']
2527
self.available_wildcard_properties = []
2628

2729
_explicit_args = kwargs.pop('_explicit_args')

dash_mp_components/dash_mp_components.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_mp_components/dash_mp_components.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_mp_components/metadata.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,24 @@
239239
},
240240
"state": {
241241
"type": {
242-
"name": "object"
242+
"name": "string"
243+
},
244+
"required": false,
245+
"description": ""
246+
},
247+
"layout": {
248+
"type": {
249+
"name": "enum",
250+
"value": [
251+
{
252+
"value": "'vertical'",
253+
"computed": false
254+
},
255+
{
256+
"value": "'horizontal'",
257+
"computed": false
258+
}
259+
]
243260
},
244261
"required": false,
245262
"description": ""

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/components/MatSidebar.react.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import PropTypes from 'prop-types';
66
export default class MatSidebar extends Component {
77
render() {
88
return (
9-
<Sidebar width={100}
9+
<Sidebar width={100} layout={this.props.layout}
1010
currentApp={this.props.currentApp}
1111
onAppSelected={(v) => {
12-
//TODO filter state
13-
//this.props.setProps({state: v});
12+
console.log(v);
13+
this.props.setProps({state: v});
1414
}}/>
1515
);
1616
}
@@ -26,5 +26,6 @@ MatSidebar.propTypes = {
2626
*/
2727
setProps: PropTypes.func,
2828
currentApp: PropTypes.string,
29-
state: PropTypes.object
29+
state: PropTypes.string,
30+
layout: PropTypes.oneOf(['vertical', 'horizontal']),
3031
};

usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@
593593
enabledElements=['H', 'O']),
594594
html.P(id='p'),
595595
html.Div(id='component'),
596-
dash_mp_components.MatSidebar(id='bar')
596+
dash_mp_components.MatSidebar(id='bar', layout='horizontal')
597597
])
598598

599599

0 commit comments

Comments
 (0)