Use router for 'moderate all' link and only show when necessary

This commit is contained in:
Chi Vinh Le
2017-06-21 22:21:42 +07:00
parent 3beb62f837
commit 012ff926eb
4 changed files with 16 additions and 5 deletions
@@ -204,6 +204,7 @@ export default class Moderation extends Component {
rejectComment={props.rejectComment} />
)}
<StorySearch
assetId={assetId}
moderation={this.props.moderation}
closeSearch={this.closeSearch}
storySearchChange={this.props.storySearchChange}
@@ -49,13 +49,14 @@
font-weight: 300;
}
.cta a {
.cta > a {
display: inline-block;
cursor: pointer;
color: #000;
text-decoration: none;
font-weight: bold;
font-size: 15px;
margin: 0;
height: 50px;
box-sizing: border-box;
font-size: 15px;
font-weight: 500;
@@ -38,9 +38,11 @@ const StorySearch = (props) => {
</Button>
</div>
<div className={styles.results}>
<p className={styles.cta}>
<a href={'moderate/all'}>Moderate comments on All Stories</a>
</p>
{props.assetId &&
<div className={styles.cta}>
<a onClick={props.goToModerateAll}>Moderate comments on All Stories</a>
</div>
}
<div className={styles.storyList}>
{
@@ -45,11 +45,18 @@ class StorySearchContainer extends React.Component {
closeSearch();
}
goToModerateAll = () => {
const {router, closeSearch} = this.props;
router.push('/admin/moderate/all');
closeSearch();
}
render () {
return (
<StorySearch
search={this.search}
goToStory={this.goToStory}
goToModerateAll={this.goToModerateAll}
handleEsc={this.handleEsc}
handleEnter={this.handleEnter}
searchValue={this.state.searchValue}