viskan-deku-slideout
v1.0.1
Published
Slideout component for Deku
Downloads
17
Readme
deku-slideout
Slideout component for Deku
Install
$ npm install --save deku-slideout
Usage
import Slideout from 'deku-slideout';
const onClick = setState => {
return () => {
setState({open: true});
};
};
const onClickOutside = (open, setState) => {
return () => {
if (open) {
setState({open: false});
}
};
};
const render = ({state}, setState) => {
const {open} = state;
return (
<div>
<button onClick={onClick(setState)}>Open menu!</button>
<Slideout open={open} onClickOutside={onClickOutside(open, setState)}>
Unicorns!
</Slideout>
</div>
);
};
export default {render};