From 1e99ee9f0ebad74269c62ace233377521c3cf3d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Maneiro?=
<583546+oandregal@users.noreply.github.com>
Date: Tue, 14 Nov 2023 17:13:33 +0100
Subject: [PATCH] Fix alignment for Search & AddFilters
---
.../src/components/dataviews/add-filter.js | 145 +++++++++---------
.../src/components/dataviews/search.js | 1 +
.../src/components/dataviews/style.scss | 3 +
3 files changed, 76 insertions(+), 73 deletions(-)
diff --git a/packages/edit-site/src/components/dataviews/add-filter.js b/packages/edit-site/src/components/dataviews/add-filter.js
index bfc88626a48e8f..edcdb2098015d9 100644
--- a/packages/edit-site/src/components/dataviews/add-filter.js
+++ b/packages/edit-site/src/components/dataviews/add-filter.js
@@ -4,7 +4,6 @@
import {
privateApis as componentsPrivateApis,
Button,
- BaseControl,
Icon,
} from '@wordpress/components';
import { chevronRightSmall, plus } from '@wordpress/icons';
@@ -59,81 +58,81 @@ export default function AddFilter( { fields, view, onChangeView } ) {
}
return (
-
-
- { __( 'Add filter' ) }
-
- }
- >
- { filters.map( ( filter ) => {
- if ( filter.isVisible ) {
- return (
-
- { filter.name }
-
- );
- }
-
+
+ { __( 'Add filter' ) }
+
+ }
+ >
+ { filters.map( ( filter ) => {
+ if ( filter.isVisible ) {
return (
-
- }
- >
- { filter.name }
-
- }
+ disabled={ true }
>
- { filter.elements.map( ( element ) => (
- {
- onChangeView( ( currentView ) => ( {
- ...currentView,
- page: 1,
- filters: [
- ...currentView.filters,
- {
- field: filter.field,
- operator: 'in',
- value: element.value,
- },
- ],
- } ) );
- } }
- role="menuitemcheckbox"
- >
- { element.label }
-
- ) ) }
-
+ { filter.name }
+
);
- } ) }
-
- {
- onChangeView( ( currentView ) => ( {
- ...currentView,
- page: 1,
- filters: [],
- } ) );
- } }
- role="menuitemcheckbox"
- >
- { __( 'Reset filters' ) }
-
-
-
+ }
+
+ return (
+ }
+ >
+ { filter.name }
+
+ }
+ >
+ { filter.elements.map( ( element ) => (
+ {
+ onChangeView( ( currentView ) => ( {
+ ...currentView,
+ page: 1,
+ filters: [
+ ...currentView.filters,
+ {
+ field: filter.field,
+ operator: 'in',
+ value: element.value,
+ },
+ ],
+ } ) );
+ } }
+ role="menuitemcheckbox"
+ >
+ { element.label }
+
+ ) ) }
+
+ );
+ } ) }
+
+ {
+ onChangeView( ( currentView ) => ( {
+ ...currentView,
+ page: 1,
+ filters: [],
+ } ) );
+ } }
+ role="menuitemcheckbox"
+ >
+ { __( 'Reset filters' ) }
+
+
);
}
diff --git a/packages/edit-site/src/components/dataviews/search.js b/packages/edit-site/src/components/dataviews/search.js
index 3ade147922ac99..b75b19537283a3 100644
--- a/packages/edit-site/src/components/dataviews/search.js
+++ b/packages/edit-site/src/components/dataviews/search.js
@@ -35,6 +35,7 @@ export default function Search( { label, view, onChangeView } ) {
value={ search }
label={ searchLabel }
placeholder={ searchLabel }
+ className="dataviews-control"
size="compact"
/>
);
diff --git a/packages/edit-site/src/components/dataviews/style.scss b/packages/edit-site/src/components/dataviews/style.scss
index 76e6fca78de67d..44930f45e137ba 100644
--- a/packages/edit-site/src/components/dataviews/style.scss
+++ b/packages/edit-site/src/components/dataviews/style.scss
@@ -8,6 +8,9 @@
min-height: 100%;
}
}
+.dataviews-control > .components-base-control__field {
+ margin-bottom: 0;
+}
.dataviews-pagination {
margin-top: auto;