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

DataViews: fix spacing when combining combined fields #67226

Merged
merged 2 commits into from
Nov 22, 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
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ export const themeFields: Field< Theme >[] = [
},
{ id: 'requires', label: 'Requires at least' },
{ id: 'tested', label: 'Tested up to' },
{ id: 'icon', label: 'Icon', render: () => <Icon icon={ image } /> },
{
id: 'tags',
label: 'Tags',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,28 @@ export const FieldsNoSortableNoHidable = () => {
export const CombinedFields = () => {
const defaultLayoutsThemes = {
table: {
fields: [ 'theme', 'requires', 'tested' ],
fields: [ 'theme_with_combined', 'theme_with_simple' ],
layout: {
primaryField: 'name',
combinedFields: [
{
id: 'theme',
id: 'name_tested',
label: 'Theme',
children: [ 'name', 'description' ],
children: [ 'name', 'tested' ],
direction: 'vertical',
},
{
id: 'theme_with_combined',
label: 'Combine combined fields',
children: [ 'icon', 'name_tested' ],
direction: 'horizontal',
},
{
id: 'theme_with_simple',
label: 'Combine simple fields',
children: [ 'icon', 'name' ],
direction: 'horizontal',
},
] as CombinedField[],
styles: {
theme: {
Expand Down
6 changes: 5 additions & 1 deletion packages/dataviews/src/dataviews-layouts/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ function TableColumnCombined< Item >( {
) );

if ( field.direction === 'horizontal' ) {
return <HStack spacing={ 3 }>{ children }</HStack>;
return (
<HStack spacing={ 3 } justify="flex-start">
{ children }
</HStack>
);
}
return <VStack spacing={ 0 }>{ children }</VStack>;
}
Expand Down
Loading