mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 19:44:21 +00:00
use props.location instead of window
This commit is contained in:
parent
df3ddd7351
commit
8e530fe476
@ -1,6 +1,7 @@
|
|||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Link} from 'react-router';
|
import {Link} from 'react-router';
|
||||||
import translate from 'translations';
|
import translate from 'translations';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
@ -40,6 +41,10 @@ export default class TabsOptions extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
location: PropTypes.object
|
||||||
|
};
|
||||||
|
|
||||||
tabClick() {
|
tabClick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +55,7 @@ export default class TabsOptions extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const {location} = this.props;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<nav role='navigation' aria-label='main navigation' className='container nav-container overflowing'>
|
<nav role='navigation' aria-label='main navigation' className='container nav-container overflowing'>
|
||||||
@ -63,7 +69,7 @@ export default class TabsOptions extends Component {
|
|||||||
{
|
{
|
||||||
tabs.map((object, i) => {
|
tabs.map((object, i) => {
|
||||||
// if the window pathname is the same or similar to the tab objects name, set the active toggle
|
// if the window pathname is the same or similar to the tab objects name, set the active toggle
|
||||||
const activeOrNot = (window.location.pathname === object.link || window.location.pathname.substring(1) === object.link) ? 'active' : '';
|
const activeOrNot = (location.pathname === object.link || location.pathname.substring(1) === object.link) ? 'active' : '';
|
||||||
return (
|
return (
|
||||||
<li className={`nav-item ${activeOrNot}`}
|
<li className={`nav-item ${activeOrNot}`}
|
||||||
key={i} onClick={this.tabClick(i)}>
|
key={i} onClick={this.tabClick(i)}>
|
||||||
|
@ -8,6 +8,8 @@ import { languages, nodeList } from '../../config/data';
|
|||||||
|
|
||||||
export default class Header extends Component {
|
export default class Header extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
location: PropTypes.object,
|
||||||
|
|
||||||
// Language DropDown
|
// Language DropDown
|
||||||
changeLanguage: PropTypes.func,
|
changeLanguage: PropTypes.func,
|
||||||
languageSelection: PropTypes.object,
|
languageSelection: PropTypes.object,
|
||||||
@ -76,7 +78,7 @@ export default class Header extends Component {
|
|||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<TabsOptions {...{}} />
|
<TabsOptions {...this.props} />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -43,6 +43,7 @@ class App extends Component {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
let headerProps = {
|
let headerProps = {
|
||||||
|
location,
|
||||||
changeLanguage,
|
changeLanguage,
|
||||||
languageSelection,
|
languageSelection,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user