Skip to content

Commit

Permalink
Export and use TemplatePartArea
Browse files Browse the repository at this point in the history
  • Loading branch information
manzoorwanijk committed Jan 3, 2025
1 parent a4fea0b commit 70f681e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/core-data/src/entity-types/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import type { Context, OmitNevers } from './helpers';
import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';

type TemplatePartArea = {
export type TemplatePartArea = {
area: string;
label: string;
icon: string;
description: string;
};

type TemplateType = {
export type TemplateType = {
title: string;
description: string;
slug: string;
Expand Down
8 changes: 5 additions & 3 deletions packages/core-data/src/entity-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import type { Context, Updatable } from './helpers';
import type { Attachment } from './attachment';
import type { Base, TemplatePartArea, TemplateType } from './base';
import type { Comment } from './comment';
import type { GlobalStylesRevision } from './global-styles-revision';
import type { MenuLocation } from './menu-location';
Expand All @@ -12,7 +13,6 @@ import type { Page } from './page';
import type { Plugin } from './plugin';
import type { Post } from './post';
import type { PostStatusObject } from './post-status';
import type { Base } from './base';
import type { PostRevision } from './post-revision';
import type { Settings } from './settings';
import type { Sidebar } from './sidebar';
Expand All @@ -39,15 +39,17 @@ export type {
Page,
Plugin,
Post,
PostStatusObject,
PostRevision,
PostStatusObject,
Settings,
Sidebar,
Taxonomy,
TemplatePartArea,
TemplateType,
Theme,
Type,
Updatable,
User,
Type,
Widget,
WidgetType,
WpTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
__experimentalVStack as VStack,
} from '@wordpress/components';
import { useInstanceId } from '@wordpress/compose';
import type { UnstableBase } from '@wordpress/core-data';
import type { TemplatePartArea } from '@wordpress/core-data';
import { store as coreStore } from '@wordpress/core-data';
import { useDispatch, useSelect } from '@wordpress/data';
import { useState } from '@wordpress/element';
Expand Down Expand Up @@ -129,7 +129,7 @@ export function CreateTemplatePartModalContents( {
const defaultTemplatePartAreas = useSelect(
( select ) =>
select( coreStore ).getEntityRecord< {
default_template_part_areas: UnstableBase[ 'default_template_part_areas' ];
default_template_part_areas: Array< TemplatePartArea >;
} >( 'root', '__unstableBase' )?.default_template_part_areas,
[]
);
Expand Down

0 comments on commit 70f681e

Please sign in to comment.