add toggle button for sites

This commit is contained in:
Lachlan Kermode
2019-01-08 14:02:25 +00:00
parent 7ca8610bfa
commit d9c86ee6a8
8 changed files with 82 additions and 64 deletions

View File

@@ -1,11 +1,13 @@
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 ToolbarBottomActions from './ToolbarBottomActions.jsx';
import copy from '../js/data/copy.json';
import { trimAndEllipse } from '../js/utilities.js';
@@ -112,7 +114,6 @@ class Toolbar extends React.Component {
{this.renderToolbarTab(0, 'Focus stories')}
{this.renderToolbarTab(1, 'Explore freely')}
</div>
{/* <ToolbarBottomActions /> */}
</div>
)
}
@@ -124,7 +125,7 @@ class Toolbar extends React.Component {
{this.renderClosePanel()}
<Tabs selectedIndex={this.state._selected}>
{this.renderToolbarNarrativePanel()}
{this.renderToolbarTagPanel()}
{/* {this.renderToolbarTagPanel()} */}
</Tabs>
</div>
)
@@ -159,7 +160,12 @@ class Toolbar extends React.Component {
{this.renderToolbarTab(0, 'Narratives')}
{(isTags) ? this.renderToolbarTab(1, 'Explore by tag') : ''}
</div>
{/* <ToolbarBottomActions /> */}
<ToolbarBottomActions
sites={{
enabled: this.props.sitesShowing,
toggle: this.props.actions.toggleSites,
}}
/>
</div>
)
}
@@ -187,7 +193,14 @@ function mapStateToProps(state) {
viewFilters: state.app.filters.views,
features: state.app.features,
narrative: state.app.narrative,
sitesShowing: state.app.flags.isShowingSites
}
}
export default connect(mapStateToProps)(Toolbar)
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(actions, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Toolbar)