Skip to content

Commit

Permalink
Patterns page: enable table layout (#60337)
Browse files Browse the repository at this point in the history
Co-authored-by: oandregal <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: bgardner <[email protected]>
  • Loading branch information
4 people authored Apr 2, 2024
1 parent e88f41e commit 6f2e542
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/edit-site/src/components/page-patterns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { usePrevious } from '@wordpress/compose';
import Page from '../page';
import {
LAYOUT_GRID,
LAYOUT_TABLE,
PATTERN_TYPES,
TEMPLATE_PART_POST_TYPE,
PATTERN_SYNC_TYPES,
Expand Down Expand Up @@ -65,6 +66,9 @@ const { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(
const templatePartIcons = { header, footer, uncategorized };
const EMPTY_ARRAY = [];
const defaultConfigPerViewType = {
[ LAYOUT_TABLE ]: {
primaryField: 'title',
},
[ LAYOUT_GRID ]: {
mediaField: 'preview',
primaryField: 'title',
Expand Down Expand Up @@ -147,6 +151,7 @@ function Preview( { item, categoryId, viewType } ) {
postId: isUserPattern ? item.id : item.name,
categoryId,
categoryType: isTemplatePart ? item.type : PATTERN_TYPES.theme,
canvas: 'edit',
} );

return (
Expand Down Expand Up @@ -202,6 +207,7 @@ function Title( { item, categoryId } ) {
postId: isUserPattern ? item.id : item.name,
categoryId,
categoryType: isTemplatePart ? item.type : PATTERN_TYPES.theme,
canvas: 'edit',
} );
if ( ! isUserPattern && templatePartIcons[ categoryId ] ) {
itemIcon = templatePartIcons[ categoryId ];
Expand Down Expand Up @@ -399,7 +405,7 @@ export default function DataviewsPatterns() {
view={ view }
onChangeView={ onChangeView }
deferredRendering
supportedLayouts={ [ LAYOUT_GRID ] }
supportedLayouts={ [ LAYOUT_GRID, LAYOUT_TABLE ] }
/>
</Page>
</ExperimentalBlockEditorProvider>
Expand Down

0 comments on commit 6f2e542

Please sign in to comment.