// - Import react components import React, { Component } from 'react' import _ from 'lodash' import { Route, Switch, withRouter, Redirect, NavLink } from 'react-router-dom' import { connect } from 'react-redux' import { push } from 'react-router-redux' import Menu from 'material-ui/Menu' import MenuItem from 'material-ui/MenuItem' import Divider from 'material-ui/Divider' import SvgArrowLeft from 'material-ui/svg-icons/hardware/keyboard-arrow-left' import SvgHome from 'material-ui/svg-icons/action/home' import SvgFeedback from 'material-ui/svg-icons/action/feedback' import SvgSettings from 'material-ui/svg-icons/action/settings' import SvgAccountCircle from 'material-ui/svg-icons/action/account-circle' import SvgPeople from 'material-ui/svg-icons/social/people' // - Import app components import Sidebar from 'Sidebar' import Blog from 'Blog' import HomeHeader from 'HomeHeader' import SidebarContent from 'SidebarContent' import SidebarMain from 'SidebarMain' import Profile from 'Profile' import PostPage from 'PostPage' import People from 'People' // - Import API import CircleAPI from 'CircleAPI' // - Import actions import * as globalActions from 'globalActions' // - Create Home component class export class Home extends Component { // Constructor constructor(props) { super(props) // Default state this.state = { sidebarOpen: () => _, sidebarStatus: true, sidebaOverlay: false } // Binding function to `this` this.sidebar = this.sidebar.bind(this) this.sidebarStatus = this.sidebarStatus.bind(this) this.sidebarOverlay = this.sidebarOverlay.bind(this) this.handleCloseSidebar = this.handleCloseSidebar.bind(this) } /** * handle close sidebar */ handleCloseSidebar = () => { this.state.sidebarOpen(false, 'overlay') } /** * Change sidebar overlay status * @param {boolean} status if is true, the sidebar is on overlay status */ sidebarOverlay = (status) => { this.setState({ sidebarOverlay: status }) } /** * Pass function to change sidebar status * @param {boolean} open is a function callback to change sidebar status out of sidebar component */ sidebar = (open) => { this.setState({ sidebarOpen: open }) } /** * Change sidebar status if is open or not * @param {boolean} status is true, if the sidebar is open */ sidebarStatus = (status) => { this.setState({ sidebarStatus: status }) } /** * Render DOM component * * @returns DOM * * @memberof Home */ render() { return (