Skip to content

Commit 125051c

Browse files
committed
Use Nav with user menu in "dashboard" layout
1 parent 611730c commit 125051c

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

client/components/Nav.jsx

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,21 @@ class Nav extends React.PureComponent {
217217
this.timer = setTimeout(this.setDropdown.bind(this, 'none'), 10);
218218
}
219219

220+
renderDashboardMenu(navDropdownState) {
221+
return (
222+
<ul className="nav__items-left" title="project-menu">
223+
<li className="nav__item-logo">
224+
<InlineSVG src={logoUrl} alt="p5.js logo" className="svg__logo" />
225+
</li>
226+
<li className="nav__item nav__item--no-icon">
227+
<Link to="/">
228+
<span className="nav__item-header">Editor</span>
229+
</Link>
230+
</li>
231+
</ul>
232+
);
233+
}
234+
220235
renderProjectMenu(navDropdownState) {
221236
return (
222237
<ul className="nav__items-left" title="project-menu">
@@ -607,6 +622,16 @@ class Nav extends React.PureComponent {
607622
return null;
608623
}
609624

625+
renderLeftLayout(navDropdownState) {
626+
switch (this.props.layout) {
627+
case 'dashboard':
628+
return this.renderDashboardMenu(navDropdownState);
629+
case 'project':
630+
default:
631+
return this.renderProjectMenu(navDropdownState);
632+
}
633+
}
634+
610635
render() {
611636
const navDropdownState = {
612637
file: classNames({
@@ -630,10 +655,10 @@ class Nav extends React.PureComponent {
630655
'nav__item--open': this.state.dropdownOpen === 'account'
631656
})
632657
};
633-
658+
634659
return (
635660
<nav className="nav" title="main-navigation" ref={(node) => { this.node = node; }}>
636-
{this.renderProjectMenu(navDropdownState)}
661+
{this.renderLeftLayout(navDropdownState)}
637662
{this.renderUserMenu(navDropdownState)}
638663
{/*
639664
<div className="nav__announce">
@@ -685,15 +710,17 @@ Nav.propTypes = {
685710
stopSketch: PropTypes.func.isRequired,
686711
setAllAccessibleOutput: PropTypes.func.isRequired,
687712
newFile: PropTypes.func.isRequired,
688-
newFolder: PropTypes.func.isRequired
713+
newFolder: PropTypes.func.isRequired,
714+
layout: PropTypes.oneOf(['dashboard', 'project'])
689715
};
690716

691717
Nav.defaultProps = {
692718
project: {
693719
id: undefined,
694720
owner: undefined
695721
},
696-
cmController: {}
722+
cmController: {},
723+
layout: 'project'
697724
};
698725

699726
function mapStateToProps(state) {

client/modules/User/pages/DashboardView.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { bindActionCreators } from 'redux';
55
import { browserHistory } from 'react-router';
66

77
import { updateSettings, initiateVerification, createApiKey, removeApiKey } from '../actions';
8-
import NavBasic from '../../../components/NavBasic';
8+
import Nav from '../../../components/Nav';
99

1010
import AssetList from '../../IDE/components/AssetList';
1111
import SketchList from '../../IDE/components/SketchList';
@@ -68,7 +68,7 @@ class DashboardView extends React.Component {
6868

6969
return (
7070
<div className="dashboard">
71-
<NavBasic onBack={this.closeAccountPage} />
71+
<Nav layout="dashboard" />
7272

7373
<section className="dashboard-header">
7474
<div className="dashboard-header__header">

client/styles/components/_nav.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
}
4444
}
4545

46-
.nav__item:first-child {
46+
.nav__item:first-child,
47+
.nav__item--no-icon {
4748
padding-left: #{15 / $base-font-size}rem;
4849
}
4950

@@ -179,4 +180,4 @@
179180
color: getThemifyVariable('button-hover-color');
180181
}
181182
}
182-
}
183+
}

0 commit comments

Comments
 (0)