2019-07-02 08:10:25 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
2020-01-14 23:14:54 +00:00
|
|
|
import { withRouter } from 'react-router-dom';
|
2019-07-02 08:10:25 +01:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
import { NavLink } from 'react-router-dom';
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
|
|
|
value: state.getIn(['search', 'value']),
|
|
|
|
submitted: state.getIn(['search', 'submitted']),
|
|
|
|
});
|
|
|
|
|
2020-01-14 23:14:54 +00:00
|
|
|
export default
|
|
|
|
@withRouter
|
|
|
|
@connect(mapStateToProps)
|
|
|
|
class Header extends React.PureComponent {
|
2019-07-02 08:10:25 +01:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
value: PropTypes.string,
|
|
|
|
submitted: PropTypes.bool,
|
|
|
|
};
|
|
|
|
|
|
|
|
state = {
|
|
|
|
submittedValue: '',
|
|
|
|
};
|
|
|
|
|
|
|
|
componentWillReceiveProps (nextProps) {
|
|
|
|
if (nextProps.submitted) {
|
|
|
|
const submittedValue = nextProps.value;
|
|
|
|
this.setState({submittedValue})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { submittedValue } = this.state;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='search-header'>
|
|
|
|
<div className='search-header__text-container'>
|
|
|
|
<h1 className='search-header__title-text'>
|
|
|
|
{submittedValue}
|
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
<div className='search-header__type-filters'>
|
|
|
|
<div className='account__section-headline'>
|
|
|
|
<div className='search-header__type-filters-tabs'>
|
2020-01-14 23:14:54 +00:00
|
|
|
<NavLink to='/search' exact activeClassName='active'>
|
2019-07-02 08:10:25 +01:00
|
|
|
<FormattedMessage id='search_results.top' defaultMessage='Top' />
|
|
|
|
</NavLink>
|
2020-01-14 23:14:54 +00:00
|
|
|
<NavLink to='/search/people' exact activeClassName='active'>
|
2019-07-02 08:10:25 +01:00
|
|
|
<FormattedMessage id='search_results.accounts' defaultMessage='People' />
|
|
|
|
</NavLink>
|
2020-01-14 23:14:54 +00:00
|
|
|
<NavLink to='/search/hashtags' exact activeClassName='active'>
|
2019-07-02 08:10:25 +01:00
|
|
|
<FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' />
|
|
|
|
</NavLink>
|
2020-01-14 23:14:54 +00:00
|
|
|
<NavLink to='/search/groups' exact activeClassName='active'>
|
2019-07-02 08:10:25 +01:00
|
|
|
<FormattedMessage id='search_results.groups' defaultMessage='Groups' />
|
2020-01-14 23:14:54 +00:00
|
|
|
</NavLink>
|
2019-07-02 08:10:25 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2020-01-14 23:14:54 +00:00
|
|
|
}
|