Skip to content

Commit

Permalink
DataViews: enable grid layout for templates & parts (#58137)
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal authored Jan 23, 2024
1 parent 4fd6808 commit 3ff31f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/dataviews/src/view-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,11 @@ const ViewActions = memo( function ViewActions( {
}
>
<DropdownMenuGroup>
{ window?.__experimentalAdminViews && (
<ViewTypeMenu
view={ view }
onChangeView={ onChangeView }
supportedLayouts={ supportedLayouts }
/>
) }
<ViewTypeMenu
view={ view }
onChangeView={ onChangeView }
supportedLayouts={ supportedLayouts }
/>
<SortMenu
fields={ fields }
view={ view }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ const { useHistory, useLocation } = unlock( routerPrivateApis );

const EMPTY_ARRAY = [];

const SUPPORTED_LAYOUTS = window?.__experimentalAdminViews
? [ LAYOUT_TABLE, LAYOUT_GRID, LAYOUT_LIST ]
: [ LAYOUT_TABLE, LAYOUT_GRID ];

const defaultConfigPerViewType = {
[ LAYOUT_TABLE ]: {
primaryField: 'title',
Expand Down Expand Up @@ -441,6 +445,7 @@ export default function PageTemplatesTemplateParts( { postType } ) {
onChangeView={ onChangeView }
onSelectionChange={ onSelectionChange }
deferredRendering={ ! view.hiddenFields?.includes( 'preview' ) }
supportedLayouts={ SUPPORTED_LAYOUTS }
/>
</Page>
);
Expand Down

0 comments on commit 3ff31f8

Please sign in to comment.