Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added responsiveness to the sidebar #162

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/Navbar/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ class Navbar extends Component {
this.setState({
collapsed: !this.state.collapsed
});

};
toggleSidebarResize = ()=>{
if(!this.state.collapsed)
{
this.toggle()
}
}

openLoginModal = () => {
this.props.openLoginModal();
Expand All @@ -50,7 +57,6 @@ class Navbar extends Component {
openloginModal,
openregisterModal
} = this.props.auth;

return (
<Router>
<Layout>
Expand Down Expand Up @@ -105,7 +111,7 @@ class Navbar extends Component {
)}
</Header>
<Layout>
<SideBar collapseProp={this.state.collapsed} />
<SideBar collapseProp={this.state.collapsed} toggle={this.toggleSidebarResize}/>
<Route path="/admin" component={AdminNavbar} />
<Content
style={{
Expand Down
6 changes: 6 additions & 0 deletions src/components/Sidebar/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class SideBar extends Component {
});
}
}
toggleSidebar = (broken)=>{
if(broken)
this.props.toggle()
}
render() {
const { pending } = this.state;
const categoryList = this.props.categoryService.categories.map(category => {
Expand All @@ -51,6 +55,8 @@ class SideBar extends Component {
collapsedWidth={0}
width={250}
collapsed={this.props.collapseProp}
breakpoint='sm'
onBreakpoint={this.toggleSidebar}
>
<Menu theme="dark" mode="inline">
{categoryList}
Expand Down