Skip to content

Commit

Permalink
fix(Filter): add story and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Innders committed Jan 13, 2025
1 parent 82edff4 commit a5b9f16
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/SearchFilter/SearchFilter.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ const options: Option[] = [
{
id: 'status',
label: 'Status',
operator: 'OR',
allowExcludes: true,
allowHasValue: true,
allowNoValue: true,
allowsCustomValues: true,
operatorChangeable: true,

values: [
{ id: 'waiting', label: 'Waiting', color: '#FFA500', icon: 'hourglass_empty' },
{ id: 'inProgress', label: 'In Progress', color: '#4CAF50', icon: 'play_circle' },
Expand Down
4 changes: 4 additions & 0 deletions src/SearchFilter/SearchFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ export const SearchFilter: FC<SearchFilterProps> = ({
)
}

const operator = parentFilter.operator || 'OR'

// Create a new parent filter with the updated values
const updatedParentFilter = {
...parentFilter,
operator,
values: updatedValues,
}

Expand Down Expand Up @@ -332,6 +335,7 @@ export const SearchFilter: FC<SearchFilterProps> = ({
isHasValueAllowed={!!parentOption?.allowHasValue}
isNoValueAllowed={!!parentOption?.allowNoValue}
isInvertedAllowed={!!parentOption?.allowExcludes}
operatorChangeable={!!parentOption?.operatorChangeable}
preserveOrderFields={preserveOrderFields}
onSelect={handleOptionSelect}
onInvert={handleInvertFilter}
Expand Down

0 comments on commit a5b9f16

Please sign in to comment.