Skip to content

Commit

Permalink
Small tweaks per review
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Dec 5, 2024
1 parent 5d4862a commit e6f61cd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,13 @@ function ViewTypeMenu( {
case 'list':
case 'grid':
case 'table':
const viewWithoutLayout = { ...view };
if ( 'layout' in viewWithoutLayout ) {
delete viewWithoutLayout.layout;
}
// @ts-expect-error
return onChangeView( {
...view,
...viewWithoutLayout,
type: e.target.value,
...defaultLayouts[ e.target.value ],
} );
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/page-patterns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ const DEFAULT_VIEW = {
perPage: 20,
titleField: 'title',
mediaField: 'preview',
layout: defaultLayouts[ LAYOUT_GRID ].layout,
fields: [ 'sync-status' ],
filters: [],
...defaultLayouts[ LAYOUT_GRID ],
};

export default function DataviewsPatterns() {
Expand Down
6 changes: 0 additions & 6 deletions packages/edit-site/src/components/page-templates/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ const defaultLayouts = {
showMedia: false,
layout: {
styles: {
__primary: {
maxWidth: 400,
minWidth: 320,
},
author: {
width: '1%',
},
Expand All @@ -49,11 +45,9 @@ const defaultLayouts = {
},
[ LAYOUT_GRID ]: {
showMedia: true,
layout: {},
},
[ LAYOUT_LIST ]: {
showMedia: false,
layout: {},
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,9 @@ import {
} from '../../utils/constants';

export const defaultLayouts = {
[ LAYOUT_TABLE ]: {
layout: {
styles: {
__primary: {
maxWidth: 300,
},
},
},
},
[ LAYOUT_GRID ]: {
layout: {},
},
[ LAYOUT_LIST ]: {
layout: {},
},
[ LAYOUT_TABLE ]: {},
[ LAYOUT_GRID ]: {},
[ LAYOUT_LIST ]: {},
};

const DEFAULT_POST_BASE = {
Expand Down

0 comments on commit e6f61cd

Please sign in to comment.