Skip to content

Commit

Permalink
feat: add search reset icon in grants table
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanoshadjipetrou committed Mar 21, 2023
1 parent 1785449 commit a1b8e17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ export function FilterGroup(props: FilterGroupCompProps) {
});

function onFilterRemove(option: string) {
console.log(
appliedFilters,
appliedFiltersChildren,
appliedFiltersGrandChildren
);
let fAppliedFilterOption: FilterGroupOptionModel | undefined;
props.options.every((o) => {
if (o.value === option) {
Expand Down
17 changes: 15 additions & 2 deletions src/app/modules/grants-module/components/Search/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from "react";
import get from "lodash/get";
import CloseIcon from "@material-ui/icons/Close";
import { useCMSData } from "app/hooks/useCMSData";
import { SearchIcon } from "app/assets/icons/Search";
import IconButton from "@material-ui/core/IconButton";
import {
container,
input,
} from "app/modules/grants-module/components/Search/styles";
import { useCMSData } from "app/hooks/useCMSData";

interface SearchLayoutProps {
value: string;
Expand All @@ -26,7 +28,18 @@ export function SearchLayout(props: SearchLayoutProps) {
props.setValue(e.target.value)
}
/>
<SearchIcon />
{props.value.length === 0 ? (
<SearchIcon />
) : (
<IconButton
onClick={() => props.setValue("")}
css={`
padding: 0;
`}
>
<CloseIcon />
</IconButton>
)}
</div>
);
}

0 comments on commit a1b8e17

Please sign in to comment.