Skip to content

Commit

Permalink
Fix/hide clear search button (#2862)
Browse files Browse the repository at this point in the history
Fixes #2860

Currently, the X icon in the search field, used to clear the search term, is always present. It should only show when there is a search term to clear. This fixes that.
  • Loading branch information
sandymcfadden authored Apr 28, 2021
1 parent f1a881e commit a7becbc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Fixed spacing on unsynced notes warning message [#2797](https://github.com/automattic/simplenote-electron/pull/2797)
- Fixed cut off issue for dialogs when the window is too small [#2815](https://github.com/automattic/simplenote-electron/pull/2815), [#2834](https://github.com/automattic/simplenote-electron/pull/2834), [#2863](https://github.com/automattic/simplenote-electron/pull/2863)
- Fixed unnecessary separators in the Electron builds File and Edit menus when not yet logged in (props @Klauswk) [#2724](https://github.com/automattic/simplenote-electron/pull/2724)
- Fixed the clear search button so it does not appear unless there is a search term to clear [#2862](https://github.com/automattic/simplenote-electron/pull/2862)

## [v2.9.0]

Expand Down
17 changes: 9 additions & 8 deletions lib/search-field/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,15 @@ export class SearchField extends Component<Props> {
value={searchQuery}
spellCheck={false}
/>
<button
aria-label="Clear search"
className="icon-button"
hidden={!hasQuery}
onClick={this.clearQuery}
>
<SmallCrossIcon />
</button>
{hasQuery && (
<button
aria-label="Clear search"
className="icon-button"
onClick={this.clearQuery}
>
<SmallCrossIcon />
</button>
)}
</div>
);
}
Expand Down

0 comments on commit a7becbc

Please sign in to comment.