-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
DataViews: make filters footprint more condensed #56983
Changes from all commits
2e8549a
a449282
eb1cf7c
fa6eb1a
d64084f
8237008
f24b029
302519a
822bcb0
ff7c32b
8f27095
77d7ec4
65e0f02
1a8c1c1
dd0aafb
5847082
93b2bc3
9dc6977
975c2ae
cd2b253
8482576
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ import { Children, Fragment } from '@wordpress/element'; | |
/** | ||
* Internal dependencies | ||
*/ | ||
import { OPERATOR_IN, OPERATOR_NOT_IN } from './constants'; | ||
import { OPERATOR_IN, OPERATOR_NOT_IN, LAYOUT_LIST } from './constants'; | ||
import { unlock } from './lock-unlock'; | ||
|
||
const { | ||
|
@@ -73,6 +73,10 @@ function WithSeparators( { children } ) { | |
} | ||
|
||
export default function FilterSummary( { filter, view, onChangeView } ) { | ||
if ( view.type === LAYOUT_LIST ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar with the above comment. it feels to me we should not make such explicit checks. Maybe this are kind of a config of a layout(showFilterSummary, etc..)? 🤔 This also applies to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you suggest making it a prop, are you thinking of lifting it up all the way to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if it's what you were looking for, but since you mentioned it, I revisited this code and prepared a follow-up to lift the visibility control to the parent #57056 |
||
return null; | ||
} | ||
|
||
const filterInView = view.filters.find( ( f ) => f.field === filter.field ); | ||
const activeElement = filter.elements.find( | ||
( element ) => element.value === filterInView?.value | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like it's better as a prop like
showFilterCount
.