Show Searchbar clear button only when text is entered
This commit is contained in:
parent
66704e3788
commit
3554fe9eb4
2 changed files with 5 additions and 1 deletions
|
@ -46,7 +46,7 @@ class Searchbar extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const { searchValue } = this.state;
|
const { searchValue } = this.state;
|
||||||
return (
|
return (
|
||||||
<div className="searchbar">
|
<div className={`searchbar ${searchValue === '' ? 'searchbar--is-empty' : ''}`}>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="searchbar__button"
|
className="searchbar__button"
|
||||||
|
|
|
@ -68,3 +68,7 @@ button[type="submit"].searchbar__button {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.searchbar--is-empty .searchbar__clear-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue