@hawk-ui/navigation-drawer
v4.4.4
Published
hawk-ui: Basic Navigation Drawer Component
Downloads
514
Maintainers
Readme
Installation
To install a component run
$ npm install @hawk-ui/navigation-drawer --save
Please import CSS styles via
@import '/path__to__node_modules/@hawk-ui/navigation-drawer/dist/index.min.css
Usage
With Close Button and background dark
import NavigationDrawer from '@hawk-ui/navigation-drawer';
initialState = {
isLeftOpen: false,
isRightOpen: false,
};
<div style={{ display: 'flex', justifyContent: 'space-around' }}>
<div>
<NavigationDrawer
isOpen={state.isLeftOpen}
hideCloseIcon
type="dark"
title="Modal Title"
position="left"
onKeyDown={(event) => {
setState({ isLeftOpen: false });
}}
onClose={() => {
setState({ isLeftOpen: false });
}}
>
<span>Navigation Drawer Body</span>
</NavigationDrawer>
<button
type="button"
className="hawk-button"
onClick={() => {
setState({ isLeftOpen: !state.isLeftOpen });
}}
>
Left Navigation Drawer
</button>
</div>
<div>
<NavigationDrawer
isOpen={state.isRightOpen}
hideCloseIcon
type="dark"
title="Modal Title"
position="right"
onKeyDown={(event) => {
setState({ isRightOpen: false });
}}
onClose={() => {
setState({ isRightOpen: false });
}}
>
<span>Navigation Drawer Body</span>
</NavigationDrawer>
<button
type="button"
className="hawk-button"
onClick={() => {
setState({ isRightOpen: !state.isRightOpen });
}}
>
Right Navigation Drawer
</button>
</div>
</div>
Without Close Button and background light
import NavigationDrawer from '@hawk-ui/navigation-drawer';
initialState = {
isLeftOpen: false,
isRightOpen: false,
};
<div style={{ display: 'flex', justifyContent: 'space-around' }}>
<div>
<NavigationDrawer
isOpen={state.isLeftOpen}
type="light"
title="Modal Title"
position="left"
onKeyDown={(event) => {
setState({ isLeftOpen: false });
}}
onClose={() => {
setState({ isLeftOpen: false });
}}
>
<span>Navigation Drawer Body</span>
</NavigationDrawer>
<button
type="button"
className="hawk-button"
onClick={() => {
setState({ isLeftOpen: !state.isLeftOpen });
}}
>
Left Navigation Drawer
</button>
</div>
<div>
<NavigationDrawer
isOpen={state.isRightOpen}
type="light"
title="Modal Title"
position="right"
onKeyDown={(event) => {
setState({ isRightOpen: false });
}}
onClose={() => {
setState({ isRightOpen: false });
}}
>
<span>Navigation Drawer Body</span>
</NavigationDrawer>
<button
type="button"
className="hawk-button"
onClick={() => {
setState({ isRightOpen: !state.isRightOpen });
}}
>
Right Navigation Drawer
</button>
</div>
</div>