Skip to content

Commit

Permalink
Responsive sidenav with active item indicator (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
psrok1 committed May 13, 2021
1 parent 85b2a39 commit e5b8954
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
7 changes: 4 additions & 3 deletions mwdb/web/src/components/Profile/ProfileView.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function ProfileNav() {
<strong>
<FontAwesomeIcon icon={faUserCog} /> Profile
</strong>
<div className="nav flex-column">
<div className="nav sidenav flex-column">
<NavLink exact to="/profile" className="nav-link">
Profile details
</NavLink>
Expand All @@ -41,6 +41,7 @@ function ProfileNav() {
API keys
</NavLink>
</div>
<hr />
</div>
);
}
Expand Down Expand Up @@ -74,10 +75,10 @@ export default function ProfileView() {
return (
<View ident="profile" fluid>
<div className="row">
<div className="col-2">
<div className="col-sm-2">
<ProfileNav />
</div>
<div className="col-8">
<div className="col-sm-8">
<Switch>
<Route exact path={["/profile", "/profile/user/:user"]}>
<ProfileDetails profile={profile} />
Expand Down
9 changes: 5 additions & 4 deletions mwdb/web/src/components/Settings/SettingsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function SettingsNav() {
...(auth.hasCapability(Capability.managingAttributes) ||
auth.hasCapability(Capability.manageUsers)
? [
<NavLink to="/admin" className="nav-link">
<NavLink exact to="/admin" className="nav-link">
Overview
</NavLink>,
]
Expand Down Expand Up @@ -109,11 +109,12 @@ function SettingsNav() {
<strong>
<FontAwesomeIcon icon={faUsersCog} /> Administration
</strong>
<div className="nav flex-column">{adminLinks}</div>
<div className="nav sidenav flex-column">{adminLinks}</div>
</React.Fragment>
) : (
[]
)}
<hr />
</div>
);
}
Expand All @@ -127,10 +128,10 @@ export default function SettingsView(props) {
fluid
>
<div className="row">
<div className="col-2">
<div className="col-sm-2">
<SettingsNav />
</div>
<div className="col-8">
<div className="col-sm-8">
<div className="tab-content">
<Switch>
<Route exact path="/admin">
Expand Down
12 changes: 12 additions & 0 deletions mwdb/web/src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ div.quick-query-bar {
margin-bottom: 6pt;
}

.sidenav .nav-link {
border-left: #eee solid;
}

.sidenav .nav-link.active {
border-left-color: var(--blue);
}

.sidenav .nav-link:hover {
border-left-color: var(--info);
}

/***
Material Design Switches for Bootstrap 4 and Material Design Bootstrap (MDB)
by djibe
Expand Down

0 comments on commit e5b8954

Please sign in to comment.