Skip to content

Commit

Permalink
DataViews: Remove second reset filter button in filter dialog (#58960)
Browse files Browse the repository at this point in the history
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
  • Loading branch information
3 people authored and youknowriad committed Feb 13, 2024
1 parent 516a0e5 commit c887629
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 44 deletions.
39 changes: 0 additions & 39 deletions packages/dataviews/src/filter-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import classnames from 'classnames';
*/
import {
Dropdown,
Button,
__experimentalVStack as VStack,
__experimentalHStack as HStack,
FlexItem,
Expand Down Expand Up @@ -133,40 +132,6 @@ function OperatorSelector( { filter, view, onChangeView } ) {
);
}

function ResetFilter( { filter, view, onChangeView, addFilterRef } ) {
const isDisabled =
filter.isPrimary &&
view.filters.find( ( _filter ) => _filter.field === filter.field )
?.value === undefined;
return (
<div className="dataviews-filter-summary__reset">
<Button
disabled={ isDisabled }
__experimentalIsFocusable
size="compact"
variant="tertiary"
style={ { justifyContent: 'center', width: '100%' } }
onClick={ () => {
onChangeView( {
...view,
page: 1,
filters: view.filters.filter(
( _filter ) => _filter.field !== filter.field
),
} );
// If the filter is not primary and can be removed, it will be added
// back to the available filters from `Add filter` component.
if ( ! filter.isPrimary ) {
addFilterRef.current?.focus();
}
} }
>
{ filter.isPrimary ? __( 'Reset' ) : __( 'Remove' ) }
</Button>
</div>
);
}

export default function FilterSummary( {
addFilterRef,
openedFilter,
Expand Down Expand Up @@ -269,10 +234,6 @@ export default function FilterSummary( {
<VStack spacing={ 0 } justify="flex-start">
<OperatorSelector { ...commonProps } />
<SearchWidget { ...commonProps } />
<ResetFilter
{ ...commonProps }
addFilterRef={ addFilterRef }
/>
</VStack>
);
} }
Expand Down
5 changes: 0 additions & 5 deletions packages/dataviews/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -627,11 +627,6 @@
}
}

.dataviews-filter-summary__reset {
padding: $grid-unit-05;
border-top: 1px solid $gray-200;
}

.dataviews-filter-summary__chip-container {
position: relative;
white-space: pre-wrap;
Expand Down

0 comments on commit c887629

Please sign in to comment.