{"id":283,"date":"2019-10-04T05:48:05","date_gmt":"2019-10-04T05:48:05","guid":{"rendered":"https:\/\/docs.theironnetwork.org\/reactify\/?page_id=283"},"modified":"2019-10-10T08:21:16","modified_gmt":"2019-10-10T08:21:16","slug":"drawers","status":"publish","type":"page","link":"https:\/\/docs.theironnetwork.org\/reactify\/drawers\/","title":{"rendered":"Drawers"},"content":{"rendered":"\n<p>You can add the component on any page in the template. You need to follow the steps given below: \u200c<\/p>\n\n\n\n<p><strong>Step 1:<\/strong> You need to create a component for drawer list styling, a state and function to handle it&#8217;s event. Also you need to add the code of drawer in the page where you want to add the component. Please check the code snippet given below, we have added the drawer in the Ecommerce Dashboard:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/**<br> * Ecommerce Dashboard<br> *\/<br> <br>import React, { Component } from 'react'<br>...<br> <br>const styles = {<br>   list: {<br>      width: 250,<br>   },<br>   listFull: {<br>      width: 'auto',<br>   },<br>};<br> <br>class EcommerceDashboard extends Component {<br> <br>    \/\/ Drawer State<br>    state = {<br>      left: false,<br>   };<br> <br>   \/\/ Drawer Function<br>   toggleDrawer = (side, open) => () => {<br>      this.setState({<br>         [side]: open,<br>      });<br>   };<br>   render() {<br>      const { match } = this.props;<br>      const { classes } = this.props;<br>      const sideList = (<br>         &lt;div className={classes.list}><br>            &lt;List><br>               &lt;ListItem button><br>                  &lt;ListItemIcon><br>                     &lt;i className=\"zmdi zmdi-inbox zmdi-hc-lg\">&lt;\/i><br>                  &lt;\/ListItemIcon><br>                  &lt;ListItemText primary=\"Inbox\" \/><br>               &lt;\/ListItem><br>               &lt;ListItem button><br>                  &lt;ListItemIcon><br>                      &lt;i className=\"zmdi zmdi-star zmdi-hc-lg\">&lt;\/i><br>                  &lt;\/ListItemIcon><br>                  &lt;ListItemText primary=\"Starred\" \/><br>               &lt;\/ListItem><br>             &lt;\/List><br>           &lt;\/div><br>         );<br>     return (<br>         &lt;div className=\"ecom-dashboard-wrapper\"><br>            ...<br>           &lt;div className=\"row\"><br>              &lt;div className=\"col-sm-6 col-md-4 mb-30\"><br>                \/\/ Drawer Code<br>                &lt;div><br>                   &lt;Button color=\"primary\" className=\"text-white mr-10 mb-10\" variant=\"contained\" onClick={this.toggleDrawer('left', true)}>Open Left&lt;\/Button> <br>                   &lt;Drawer open={this.state.left} onClose={this.toggleDrawer('left', false)}><br>                       &lt;div tabIndex={0} role=\"button\" onClick={this.toggleDrawer('left', false)}<br>                        onKeyDown={this.toggleDrawer('left', false)} ><br>                           {sideList}<br>                       &lt;\/div><br>                   &lt;\/Drawer> <br>                &lt;\/div><br>              ...<br>   <br>\/\/ Initialise with style <br>export default withStyles(styles)( EcommerceDashboard);<\/pre>\n\n\n\n<p><strong>Step 2:<\/strong> Now Import the component from its parent library.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import { withStyles } from '@material-ui\/core\/styles';<br>import Drawer from '@material-ui\/core\/Drawer';<br>import Button from '@material-ui\/core\/Button';<br>import List from '@material-ui\/core\/List';<br>import ListItem from '@material-ui\/core\/ListItem';<br>import ListItemIcon from '@material-ui\/core\/ListItemIcon';<br>import ListItemText from '@material-ui\/core\/ListItemText';<\/pre>\n\n\n\n<p>We have given you an example of adding a temporary drawer on the Ecommerce Dashboard.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"209\" src=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer-1024x209.png\" alt=\"\" class=\"wp-image-485\" srcset=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer-1024x209.png 1024w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer-300x61.png 300w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer-768x157.png 768w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer.png 1306w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"318\" src=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer2-1024x318.png\" alt=\"\" class=\"wp-image-486\" srcset=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer2-1024x318.png 1024w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer2-300x93.png 300w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer2-768x239.png 768w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer2.png 1304w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You can check some other layouts of drawer below. For adding any of the below layout in the template, please check their relative code in the <code>src->routes->components->drawers->component<\/code> folder.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"96\" src=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer3-1024x96.png\" alt=\"\" class=\"wp-image-487\" srcset=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer3-1024x96.png 1024w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer3-300x28.png 300w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer3-768x72.png 768w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer3-1568x146.png 1568w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer3.png 1617w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"355\" src=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer4-1024x355.png\" alt=\"\" class=\"wp-image-488\" srcset=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer4-1024x355.png 1024w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer4-300x104.png 300w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer4-768x266.png 768w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer4-1568x543.png 1568w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer4.png 1617w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"353\" src=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer5-1024x353.png\" alt=\"\" class=\"wp-image-489\" srcset=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer5-1024x353.png 1024w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer5-300x103.png 300w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer5-768x264.png 768w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer5-1568x540.png 1568w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/drawer5.png 1612w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<div class=\"pld-like-dislike-wrap pld-template-1\">\n    <div class=\"pld-like-wrap  pld-common-wrap\">\n    <a href=\"javascript:void(0);\" class=\"pld-like-trigger pld-like-dislike-trigger \" title=\"\" data-post-id=\"283\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-ip-check=\"0\" data-user-check=\"1\">\n                        <i class=\"fas fa-thumbs-up\"><\/i>\n                    <\/a>\n    <span class=\"pld-like-count-wrap pld-count-wrap\">1    <\/span>\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\n    <a href=\"javascript:void(0);\" class=\"pld-dislike-trigger pld-like-dislike-trigger \" title=\"\" data-post-id=\"283\" data-trigger-type=\"dislike\" data-ip-check=\"0\" data-restriction=\"cookie\" data-user-check=\"1\">\n                        <i class=\"fas fa-thumbs-down\"><\/i>\n                    <\/a>\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\n<\/div><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>You can add the component on any page in the template. You need to follow the steps given below: \u200c Step 1: You need to create a component for drawer list styling, a state and function to handle it&#8217;s event. Also you need to add the code of drawer in the page where you want [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":25,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages\/283"}],"collection":[{"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/comments?post=283"}],"version-history":[{"count":2,"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages\/283\/revisions"}],"predecessor-version":[{"id":490,"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages\/283\/revisions\/490"}],"wp:attachment":[{"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/media?parent=283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}