deku-slideout

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i deku-slideout

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • kevva