forked from yuristrelets/react-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawer.js
More file actions
37 lines (32 loc) · 938 Bytes
/
Drawer.js
File metadata and controls
37 lines (32 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from 'react';
import ClassNames from 'classnames';
import ActivableRenderer from '../hoc/ActivableRenderer';
import Overlay from '../overlay';
import style from './style';
const Drawer = (props) => {
const className = ClassNames([style.root, style[props.type]], {
[style.active]: props.active
}, props.className);
return (
<Overlay active={props.active} onClick={props.onOverlayClick}>
<div data-react-toolbox='drawer' className={className}>
<aside className={style.content}>
{props.children}
</aside>
</div>
</Overlay>
);
};
Drawer.propTypes = {
active: React.PropTypes.bool,
children: React.PropTypes.node,
className: React.PropTypes.string,
onOverlayClick: React.PropTypes.func,
type: React.PropTypes.oneOf(['left', 'right'])
};
Drawer.defaultProps = {
active: false,
className: '',
type: 'left'
};
export default ActivableRenderer()(Drawer);