Skip to content

Commit

Permalink
Add details in templates list
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Jan 17, 2024
1 parent aa9b374 commit 324bbfa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/edit-site/src/components/page-templates/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,18 @@ export default function DataviewsTemplates() {
[ setTemplateId ]
);

const onDetailsChange = useCallback(
( items ) => {
if ( items?.length === 1 ) {
history.push( {
postId: items[ 0 ].id,
postType: TEMPLATE_POST_TYPE,
} );
}
},
[ history ]
);

const authors = useMemo( () => {
if ( ! allTemplates ) {
return EMPTY_ARRAY;
Expand Down Expand Up @@ -363,6 +375,7 @@ export default function DataviewsTemplates() {
view={ view }
onChangeView={ onChangeView }
onSelectionChange={ onSelectionChange }
onDetailsChange={ onDetailsChange }
deferredRendering={
! view.hiddenFields?.includes( 'preview' )
}
Expand Down

0 comments on commit 324bbfa

Please sign in to comment.