{"id":300,"date":"2019-10-04T05:50:42","date_gmt":"2019-10-04T05:50:42","guid":{"rendered":"https:\/\/docs.theironnetwork.org\/reactify\/?page_id=300"},"modified":"2019-10-10T08:21:16","modified_gmt":"2019-10-10T08:21:16","slug":"snackbar","status":"publish","type":"page","link":"https:\/\/docs.theironnetwork.org\/reactify\/snackbar\/","title":{"rendered":"Snackbar"},"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 state and functions to handle it&#8217;s events. Also you need to add the code of snackbar in the page where you want to add the component. Please check the code snippet given below, we have added the snackbar 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>export default class EcommerceDashboard extends Component {<br>    \/\/ Snackbar State<br>    state = {<br>       open: false,<br>    };<br> <br>    \/\/ Snackbar Functions<br>    handleClick = () => {<br>        this.setState({ open: true });<br>    };<br> <br>    handleClose = (event, reason) => {<br>        if (reason === 'clickaway') {<br>           return;<br>        }<br>        this.setState({ open: false });<br>    };<br>    render() {<br>    ...<br>    \/\/ Snackbar Code<br>    &lt;div><br>       &lt;Button variant=\"contained\" color=\"primary\" className=\"text-white mr-10 mb-10 d-inline-block\"   onClick={this.handleClick}>simple snackbar&lt;\/Button><br>           &lt;Snackbar anchorOrigin={{ vertical: 'bottom', horizontal: 'left', }}<br>               open={this.state.open}<br>               autoHideDuration={6000}<br>               onClose={this.handleClose}<br>               message={&lt;span id=\"message-id\">Note archived&lt;\/span>}<br>               action={[<br>                          &lt;Button variant=\"contained\" key=\"undo\" className=\"btn-danger btn-sm text-white\" dense=\"true\" onClick={this.handleClose}> UNDO &lt;\/Button>,<br>                          &lt;IconButton key=\"close\" aria-label=\"Close\" color=\"inherit\" onClick={this.handleClose} ><br>                            &lt;i className=\"zmdi zmdi-close\">&lt;\/i><br>                          &lt;\/IconButton>,<br>                      ]}<br>                  \/><br>               &lt;\/div><\/pre>\n\n\n\n<p><strong>Step 2:<\/strong> Now Import the component from its parent library.<\/p>\n\n\n\n<p>We have given you an example of adding a simple snackbar on the Ecommerce Dashboard.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"188\" src=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar-1-1024x188.png\" alt=\"\" class=\"wp-image-564\" srcset=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar-1-1024x188.png 1024w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar-1-300x55.png 300w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar-1-768x141.png 768w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar-1.png 1308w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"514\" src=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar2-1-1024x514.png\" alt=\"\" class=\"wp-image-565\" srcset=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar2-1-1024x514.png 1024w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar2-1-300x151.png 300w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar2-1-768x385.png 768w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar2-1.png 1305w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You can check some other layouts of snackbar below. For adding any of the below layout in the template, please check their relative code in the <code>src->routes->components->snackbar->component<\/code> folder.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"404\" src=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar3-1024x404.png\" alt=\"\" class=\"wp-image-566\" srcset=\"https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar3-1024x404.png 1024w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar3-300x118.png 300w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar3-768x303.png 768w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar3-1568x619.png 1568w, https:\/\/docs.theironnetwork.org\/reactify\/wp-content\/uploads\/sites\/4\/2019\/10\/snackbar3.png 1613w\" 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=\"300\" 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=\"300\" 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 state and functions to handle it&#8217;s events. Also you need to add the code of snackbar in the page where you want to add the component. Please check [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":32,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages\/300"}],"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=300"}],"version-history":[{"count":5,"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages\/300\/revisions"}],"predecessor-version":[{"id":567,"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages\/300\/revisions\/567"}],"wp:attachment":[{"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/media?parent=300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}