1.0.1 • Published 9 years ago
deku-slideout v1.0.1
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};
License
MIT © Kevin Martensson