Skip to content

Commit

Permalink
show avatar in autocomplete conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
khavinshankar committed Oct 28, 2024
1 parent 01b6903 commit c3d083c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/components/Form/FormFields/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ type AutocompleteProps<T, V = T> = {
isLoading?: boolean;
allowRawInput?: boolean;
error?: string;
avatar?: boolean;
} & (
| {
required?: false;
Expand Down Expand Up @@ -244,11 +245,13 @@ export const Autocomplete = <T, V>(props: AutocompleteProps<T, V>) => {
<div className="flex items-center">
<div className="flex flex-col">
<div className="relative">
<Avatar
className="mr-2 h-11 w-11 rounded-full"
name={option.label}
imageUrl={option.image}
/>
{(option.image || props.avatar) && (
<Avatar
className="mr-2 h-11 w-11 rounded-full"
name={option.label}
imageUrl={option.image}
/>
)}
<span className="absolute bottom-0 right-0 z-10">
{option.icon}
</span>
Expand Down

0 comments on commit c3d083c

Please sign in to comment.