Show Searchbar clear button only when text is entered

This commit is contained in:
Andrew Nicolaou 2019-10-20 21:55:00 +02:00
parent 66704e3788
commit 3554fe9eb4
2 changed files with 5 additions and 1 deletions

View file

@ -46,7 +46,7 @@ class Searchbar extends React.Component {
render() {
const { searchValue } = this.state;
return (
<div className="searchbar">
<div className={`searchbar ${searchValue === '' ? 'searchbar--is-empty' : ''}`}>
<button
type="submit"
className="searchbar__button"

View file

@ -68,3 +68,7 @@ button[type="submit"].searchbar__button {
}
}
}
.searchbar--is-empty .searchbar__clear-button {
display: none;
}