From e671b3416c4d7da3f381a7a183b16ebe6d8851af Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Fri, 18 Jan 2019 16:58:47 +0000 Subject: [PATCH] add support from name from config --- src/components/Toolbar.jsx | 55 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/components/Toolbar.jsx b/src/components/Toolbar.jsx index 1596f29..9129ea6 100644 --- a/src/components/Toolbar.jsx +++ b/src/components/Toolbar.jsx @@ -1,15 +1,15 @@ -import React from 'react'; +import React from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import * as actions from '../actions' import * as selectors from '../selectors' -import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'; -import Search from './Search.jsx'; -import TagListPanel from './TagListPanel.jsx'; -import ToolbarBottomActions from './ToolbarBottomActions.jsx'; -import copy from '../js/data/copy.json'; -import { trimAndEllipse } from '../js/utilities.js'; +import { Tab, Tabs, TabList, TabPanel } from 'react-tabs' +import Search from './Search.jsx' +import TagListPanel from './TagListPanel.jsx' +import ToolbarBottomActions from './ToolbarBottomActions.jsx' +import copy from '../js/data/copy.json' +import { trimAndEllipse } from '../js/utilities.js' class Toolbar extends React.Component { constructor(props) { @@ -19,7 +19,7 @@ class Toolbar extends React.Component { selectTab(selected) { const _selected = (this.state._selected === selected) ? -1 : selected - this.setState({ _selected }); + this.setState({ _selected }) } renderClosePanel() { @@ -27,7 +27,7 @@ class Toolbar extends React.Component {
this.selectTab(-1)}>
- ); + ) } renderSearch() { @@ -49,7 +49,7 @@ class Toolbar extends React.Component { goToNarrative(narrative) { this.selectTab(-1) // set all unselected within this component - this.props.methods.onSelectNarrative(narrative); + this.props.methods.onSelectNarrative(narrative) } renderToolbarNarrativePanel() { @@ -68,7 +68,7 @@ class Toolbar extends React.Component { ) })} - ); + ) } renderToolbarTagPanel() { @@ -88,23 +88,23 @@ class Toolbar extends React.Component { ) } - return ''; + return '' } renderToolbarTab(_selected, label, icon_key) { - const isActive = (this.state._selected === _selected); - let classes = (isActive) ? 'toolbar-tab active' : 'toolbar-tab'; + const isActive = (this.state._selected === _selected) + let classes = (isActive) ? 'toolbar-tab active' : 'toolbar-tab' return ( -
{ this.selectTab(_selected); }}> +
{ this.selectTab(_selected) }}> {icon_key}
{label}
- ); + ) } renderToolbarPanels() { - let classes = (this.state._selected >= 0) ? 'toolbar-panels' : 'toolbar-panels folded'; + let classes = (this.state._selected >= 0) ? 'toolbar-panels' : 'toolbar-panels folded' return (
{this.renderClosePanel()} @@ -119,25 +119,26 @@ class Toolbar extends React.Component { renderToolbarNavs() { if (this.props.narratives) { return this.props.narratives.map((nar, idx) => { - const isActive = (idx === this.state._selected); + const isActive = (idx === this.state._selected) - let classes = (isActive) ? 'toolbar-tab active' : 'toolbar-tab'; + let classes = (isActive) ? 'toolbar-tab active' : 'toolbar-tab' return ( -
{ this.selectTab(idx); }}> +
{ this.selectTab(idx) }}>
{nar.label}
- ); + ) }) } - return ''; + return '' } renderToolbarTabs() { - const title = copy[this.props.language].toolbar.title; - const narratives_label = copy[this.props.language].toolbar.narratives_label; - const tags_label = copy[this.props.language].toolbar.tags_label; - const isTags = this.props.tags && this.props.tags.children; + let title = copy[this.props.language].toolbar.title + if (process.env.title) title = process.env.title + const narratives_label = copy[this.props.language].toolbar.narratives_label + const tags_label = copy[this.props.language].toolbar.tags_label + const isTags = this.props.tags && this.props.tags.children return (
@@ -165,7 +166,7 @@ class Toolbar extends React.Component { {this.renderToolbarTabs()} {this.renderToolbarPanels()}
- ); + ) } }