add 'clear' button when the search input has text
This commit is contained in:
parent
f78f136cd8
commit
cdeac2e845
1 changed files with 7 additions and 6 deletions
|
|
@ -348,22 +348,23 @@ function History() {
|
|||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
/>
|
||||
<span
|
||||
className="block px-2 py-1.5 rounded-md z-10 mx-1 my-2 select-none"
|
||||
className="block text-center px-2 py-1.5 rounded-md w-12 mx-1 my-2 select-none cursor-pointer"
|
||||
style={{
|
||||
cursor: searchTerm === "*" ? "" : "pointer",
|
||||
fontSize: "11px",
|
||||
opacity: searchTerm === "*" ? "50%" : "",
|
||||
backgroundColor:
|
||||
searchTerm === "*" ? vscInputBackground : vscBadgeBackground,
|
||||
searchTerm !== "" ? vscInputBackground : vscBadgeBackground,
|
||||
}}
|
||||
onClick={() => {
|
||||
if (searchInputRef.current.value !== "*") {
|
||||
if (searchInputRef.current.value === "") {
|
||||
searchInputRef.current.value = "*";
|
||||
setSearchTerm("*");
|
||||
} else {
|
||||
searchInputRef.current.value = "";
|
||||
setSearchTerm("");
|
||||
}
|
||||
}}
|
||||
>
|
||||
Show All
|
||||
{searchTerm === "" ? "Show All" : "Clear"}
|
||||
</span>
|
||||
</SearchBarContainer>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue