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

Update filter control position #59231

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
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
36 changes: 18 additions & 18 deletions packages/dataviews/src/dataviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,30 @@ export default function DataViews( {
<div className="dataviews-wrapper">
<VStack spacing={ 3 } justify="flex-start">
<HStack
alignment="flex-start"
alignment="top"
justify="start"
className="dataviews-filters__view-actions"
>
{ search && (
<Search
label={ searchLabel }
<HStack
justify="start"
className="dataviews-filters__container"
wrap
>
{ search && (
<Search
label={ searchLabel }
view={ view }
onChangeView={ onChangeView }
/>
) }
<Filters
fields={ _fields }
view={ view }
onChangeView={ onChangeView }
openedFilter={ openedFilter }
setOpenedFilter={ setOpenedFilter }
/>
) }
</HStack>
{ [ LAYOUT_TABLE, LAYOUT_GRID ].includes( view.type ) && (
<BulkActions
actions={ actions }
Expand All @@ -106,19 +119,6 @@ export default function DataViews( {
supportedLayouts={ supportedLayouts }
/>
</HStack>
<HStack
justify="start"
className="dataviews-filters__container"
wrap
>
<Filters
fields={ _fields }
view={ view }
onChangeView={ onChangeView }
openedFilter={ openedFilter }
setOpenedFilter={ setOpenedFilter }
/>
</HStack>
<ViewComponent
fields={ _fields }
view={ view }
Expand Down
7 changes: 6 additions & 1 deletion packages/dataviews/src/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import AddFilter from './add-filter';
import ResetFilters from './reset-filters';
import { sanitizeOperators } from './utils';
import { ENUMERATION_TYPE, OPERATOR_IN, OPERATOR_NOT_IN } from './constants';
import { __experimentalHStack as HStack } from '@wordpress/components';

const Filters = memo( function Filters( {
fields,
Expand Down Expand Up @@ -108,7 +109,11 @@ const Filters = memo( function Filters( {
);
}

return filterComponents;
return (
<HStack justify="flex-start" style={ { width: 'fit-content' } } wrap>
{ filterComponents }
</HStack>
);
} );

export default Filters;
8 changes: 1 addition & 7 deletions packages/dataviews/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,14 @@
.dataviews-filters__view-actions {
padding: $grid-unit-15 $grid-unit-40 0;
.components-search-control {
flex-grow: 1;

.components-base-control__field {
max-width: 240px;
}
}
}

.dataviews-filters__container {
padding: 0 $grid-unit-40;
}

.dataviews-filters__view-actions.components-h-stack {
align-items: center;
padding-right: $grid-unit-40;
}

.dataviews-filters-button {
Expand Down
Loading