Skip to content

Commit

Permalink
fix css search bar overflow & added keyboard hiding for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Szawara authored and Tomasz Szawara committed Sep 10, 2017
1 parent 0a284ec commit 4b64b0f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/common/SearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ const Wrapper = styled.div`
display: flex;
justify-content: center;
flex-shrink: 0;
margin-top: 30px;
margin: 20px;
`;

const Input = styled.input`
flex-grow: 3;
font-size: 20px;
padding: 10px;
color: palevioletred;
Expand All @@ -25,6 +26,7 @@ const Input = styled.input`
`;

const Button = styled.button`
flex-grow: 1;
background-color: #B4D1B6;
color: white;
border: none;
Expand Down Expand Up @@ -64,8 +66,11 @@ class Search extends Component {
}

handleKeyPress(e) {
console.log(Object.keys(e));
console.log(e.target);
if (e.key === 'Enter') {
this.performSearch(e);
e.target.blur();
}
}

Expand All @@ -75,11 +80,12 @@ class Search extends Component {
<Input type="text" value={this.state.value}
onChange={this.handleInputChange}
onKeyPress={this.handleKeyPress}
size="2"
placeholder={PLACEHOLDER_TEXT}/>
<Button onClick={this.performSearch}>Search</Button>
</Wrapper>
);
}
}

export default Search;
export default Search;

0 comments on commit 4b64b0f

Please sign in to comment.