0
0
Fork 0

Fix reworked search

This commit is contained in:
Eugen Rochko 2017-03-31 22:44:12 +02:00
parent 7ddda65269
commit d93d6f5124
8 changed files with 30 additions and 23 deletions

View file

@ -10,6 +10,7 @@ const Search = React.createClass({
propTypes: {
value: React.PropTypes.string.isRequired,
submitted: React.PropTypes.bool,
onChange: React.PropTypes.func.isRequired,
onSubmit: React.PropTypes.func.isRequired,
onClear: React.PropTypes.func.isRequired,
@ -40,8 +41,8 @@ const Search = React.createClass({
},
render () {
const { intl, value } = this.props;
const hasValue = value.length > 0;
const { intl, value, submitted } = this.props;
const hasValue = value.length > 0 || submitted;
return (
<div className='search'>

View file

@ -8,7 +8,8 @@ import {
import Search from '../components/search';
const mapStateToProps = state => ({
value: state.getIn(['search', 'value'])
value: state.getIn(['search', 'value']),
submitted: state.getIn(['search', 'submitted'])
});
const mapDispatchToProps = dispatch => ({

View file

@ -70,9 +70,9 @@ const Compose = React.createClass({
<ComposeFormContainer />
</div>
<Motion defaultStyle={{ x: -300 }} style={{ x: spring(showSearch ? 0 : -300, { stiffness: 210, damping: 20 }) }}>
<Motion defaultStyle={{ x: -100 }} style={{ x: spring(showSearch ? 0 : -100, { stiffness: 210, damping: 20 }) }}>
{({ x }) =>
<div className='drawer__inner darker' style={{ transform: `translateX(${x}px)` }}>
<div className='drawer__inner darker' style={{ transform: `translateX(${x}%)` }}>
<SearchResultsContainer />
</div>
}