Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
UdaySagar-Git committed Apr 18, 2024
1 parent a724425 commit e5a4985
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/Components/Form/MultiSelectMenuV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ const MultiSelectMenuV2 = <T, V>(props: Props<T, V>) => {
<MultiSelectOptionChip
key={index}
label={option.selectedLabel}
onRemove={(e) => {
e.stopPropagation();
onRemove={() => {
const updatedOptions = selectedOptions.filter(
(selectedOption) =>
selectedOption.value !== option.value,
Expand Down Expand Up @@ -178,17 +177,23 @@ export default MultiSelectMenuV2;

interface MultiSelectOptionChipProps {
label: ReactNode;
onRemove?: (e: any) => void;
onRemove?: () => void;
}

export const MultiSelectOptionChip = (props: MultiSelectOptionChipProps) => {
export const MultiSelectOptionChip = ({
label,
onRemove,
}: MultiSelectOptionChipProps) => {
return (
<span className="flex items-center gap-2 rounded-full border-gray-300 bg-gray-200 px-3 text-xs text-gray-700">
<p className="py-1">{props.label}</p>
{props.onRemove && (
<p className="py-1">{label}</p>
{onRemove && (
<p
className="cursor-pointer rounded-full hover:bg-white"
onClick={props.onRemove}
onClick={(e) => {
e.stopPropagation();
onRemove();
}}
>
<CareIcon icon="l-times" className="text-base" />
</p>
Expand Down

0 comments on commit e5a4985

Please sign in to comment.