File tree Expand file tree Collapse file tree
src/components/dataviews-layouts/list Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323### Enhancements
2424
2525- Documentation: Update README.md. [ #75881 ] ( https://github.com/WordPress/gutenberg/pull/75881 )
26+ - DataViews: Improve UI in ` list ` layout when we render only title and/or media fields. [ #76042 ] ( https://github.com/WordPress/gutenberg/pull/76042 )
2627- DataViews: Adjust column spacing in table layout when no titleField is provided. [ #75410 ] ( https://github.com/WordPress/gutenberg/pull/75410 )
2728- DataViews: minimize padding for primary actions. [ #75721 ] ( https://github.com/WordPress/gutenberg/pull/75721 )
2829
Original file line number Diff line number Diff line change @@ -217,6 +217,10 @@ function ListItem< Item >( {
217217 < titleField . render item = { item } field = { titleField } />
218218 ) : null ;
219219
220+ const renderDescription = showDescription && descriptionField ?. render ;
221+ // When we have only the media and title fields, we want to center them vertically in the list item.
222+ const hasOnlyMediaAndTitle =
223+ ! ! renderedMediaField && ! renderDescription && ! otherFields . length ;
220224 const usedActions = eligibleActions ?. length > 0 && (
221225 < Stack
222226 direction = "row"
@@ -315,7 +319,7 @@ function ListItem< Item >( {
315319 direction = "row"
316320 gap = "md"
317321 justify = "start"
318- align = " flex-start"
322+ align = { hasOnlyMediaAndTitle ? 'center' : ' flex-start' }
319323 style = { { flex : 1 , minWidth : 0 } }
320324 >
321325 { renderedMediaField }
@@ -333,7 +337,7 @@ function ListItem< Item >( {
333337 </ div >
334338 { usedActions }
335339 </ Stack >
336- { showDescription && descriptionField ?. render && (
340+ { renderDescription && (
337341 < div className = "dataviews-view-list__field" >
338342 < descriptionField . render
339343 item = { item }
Original file line number Diff line number Diff line change @@ -170,7 +170,6 @@ div.dataviews-view-list {
170170 }
171171
172172 .dataviews-view-list__field-wrapper {
173- min-height : $grid-unit-05 * 13 ; // Ensures title is centrally aligned when all fields are hidden
174173 flex-grow : 1 ;
175174 min-width : 0 ;
176175 }
@@ -225,10 +224,6 @@ div.dataviews-view-list {
225224 height : $grid-unit-05 * 8 ;
226225 }
227226
228- .dataviews-view-list__field-wrapper {
229- min-height : $grid-unit-05 * 8 ;
230- }
231-
232227 .dataviews-view-list__fields {
233228 gap : $grid-unit-10 ;
234229 row-gap : $grid-unit-05 ;
@@ -257,10 +252,6 @@ div.dataviews-view-list {
257252 height : $grid-unit-05 * 16 ;
258253 }
259254
260- .dataviews-view-list__field-wrapper {
261- min-height : $grid-unit-05 * 16 ;
262- }
263-
264255 .dataviews-view-list__fields {
265256 gap : $grid-unit-20 ;
266257 row-gap : $grid-unit-10 ;
You can’t perform that action at this time.
0 commit comments