Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make filter icon custom #802

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/custom/InputSearchField/InputSearchField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface InputSearchFieldProps {
selectedData: Option[];
searchValue: string;
setSearchValue: (value: string) => void;
iconComponent?: React.ReactElement;
}

const InputSearchField: React.FC<InputSearchFieldProps> = ({
Expand All @@ -32,7 +33,8 @@ const InputSearchField: React.FC<InputSearchFieldProps> = ({
disabled,
selectedData,
searchValue,
setSearchValue
setSearchValue,
iconComponent = (<OrgIcon {...iconLarge} />) as React.ReactElement
}) => {
const [error, setError] = useState('');
const [open, setOpen] = useState(false);
Expand Down Expand Up @@ -140,9 +142,7 @@ const InputSearchField: React.FC<InputSearchFieldProps> = ({
<Box component="li" sx={{ '& > img': { mr: 2, flexShrink: 0 } }}>
<Grid container alignItems="center">
<Grid item>
<Box sx={{ color: 'text.secondary', mr: 2 }}>
<OrgIcon {...iconLarge} />
</Box>
<Box sx={{ color: 'text.secondary', mr: 2 }}>{iconComponent}</Box>
</Grid>
<Grid item xs>
<Typography variant="body2">{option.name}</Typography>
Expand All @@ -164,7 +164,7 @@ const InputSearchField: React.FC<InputSearchFieldProps> = ({
{!showAllItems && localSelectedData?.length > 0 && (
<Chip
key={localSelectedData[localSelectedData.length - 1]?.id}
avatar={<OrgIcon {...iconSmall} />}
avatar={iconComponent}
label={localSelectedData[localSelectedData.length - 1]?.name}
size="small"
onDelete={() => handleDelete(localSelectedData[localSelectedData.length - 1]?.id)}
Expand Down
Loading