Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
pr comments
  • Loading branch information
mmahalwy committed Jan 18, 2017
commit 8197bf738375c5aef5ac26f6408e7836b959c881
27 changes: 22 additions & 5 deletions src/components/GlobalNav/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ class GlobalNav extends Component {
rightControls: PropTypes.arrayOf(PropTypes.element),
handleSidebarToggle: PropTypes.func.isRequired,
isStatic: PropTypes.bool.isRequired,
user: userType
user: userType,
location: PropTypes.shape({
action: PropTypes.string,
hash: PropTypes.string,
pathname: PropTypes.string,
search: PropTypes.string,
query: PropTypes.objectOf(PropTypes.string)
})
};

static defaultProps = {
Expand Down Expand Up @@ -53,6 +60,10 @@ class GlobalNav extends Component {
return false;
}

isHome() {
return this.props.location.pathname === '/';
}

renderRightControls() {
const { user, rightControls } = this.props;

Expand Down Expand Up @@ -86,10 +97,16 @@ class GlobalNav extends Component {
<span className="icon-bar" />
</button>
<Nav className={styles.nav}>
<li>
<Link to="/"><i className="ss-icon ss-home" /></Link>
</li>
<LocaleSwitcher className="visible-xs-inline-block" />
{
!this.isHome() &&
<li>
<Link to="/"><i className="ss-icon ss-home" /></Link>
</li>
}
{
this.isHome() &&
<LocaleSwitcher className="visible-xs-inline-block" />
}
{
leftControls &&
leftControls.map(((control, index) => React.cloneElement(control, { key: index })))
Expand Down
5 changes: 3 additions & 2 deletions src/containers/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class App extends Component {
sidebar,
children,
media,
removeMedia // eslint-disable-line no-shadow
removeMedia, // eslint-disable-line no-shadow
...props
} = this.props;
debug('component:APPLICATION', 'Render');

Expand All @@ -75,7 +76,7 @@ class App extends Component {
</NoScript>
{
React.cloneElement(
nav || <GlobalNav isStatic />,
nav || <GlobalNav isStatic {...props} />,
{
handleSidebarToggle: () => this.setState({ sidebarOpen: !this.state.sidebarOpen })
}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $navbar-margin-bottom: 0px;
$navbar-default-bg: #fff;
$navbar-default-link-active-bg: transparent;
$navbar-default-link-active-color: $brand-primary;
$navbar-default-border: transparent;
$navbar-default-border: rgba(0,0,0,0.12);

$navbar-inverse-bg: $brand-primary;
$navbar-inverse-link-color: #fff;
Expand Down