Slideout component for Deku
$ npm install --save deku-slideout
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};
MIT © Kevin Martensson