From 49eb22001219b2d585fba8ad0fbe38cd937d2c63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Mon, 1 Jul 2024 13:54:35 +0200 Subject: [PATCH 01/20] Add initial DataForm structure --- packages/dataviews/src/dataform.tsx | 52 +++++++++++++++++++ packages/dataviews/src/index.ts | 1 + packages/editor/package.json | 1 + .../src/components/post-actions/actions.js | 35 +++---------- 4 files changed, 62 insertions(+), 27 deletions(-) create mode 100644 packages/dataviews/src/dataform.tsx diff --git a/packages/dataviews/src/dataform.tsx b/packages/dataviews/src/dataform.tsx new file mode 100644 index 0000000000000..1e925b49154d5 --- /dev/null +++ b/packages/dataviews/src/dataform.tsx @@ -0,0 +1,52 @@ +/** + * WordPress dependencies + */ +import { __, _x } from '@wordpress/i18n'; +import { + Button, + TextControl, + __experimentalHStack as HStack, + __experimentalVStack as VStack, +} from '@wordpress/components'; + +type DataFormProps = { + title: any; + setTitle: any; + createPage: any; + closeModal: any; + isCreatingPage: any; +}; + +export default function DataForm( { + createPage, + title, + setTitle, + closeModal, + isCreatingPage, +}: DataFormProps ) { + return ( +
+ ); +} diff --git a/packages/dataviews/src/index.ts b/packages/dataviews/src/index.ts index 31f44e5ed9750..f4750bbbd2cd5 100644 --- a/packages/dataviews/src/index.ts +++ b/packages/dataviews/src/index.ts @@ -2,3 +2,4 @@ export { default as DataViews } from './dataviews'; export { VIEW_LAYOUTS } from './layouts'; export { filterSortAndPaginate } from './filter-and-sort-data-view'; export type * from './types'; +export { default as DataForm } from './dataform'; diff --git a/packages/editor/package.json b/packages/editor/package.json index 932be1a1799fc..bdda258d1453f 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -42,6 +42,7 @@ "@wordpress/compose": "file:../compose", "@wordpress/core-data": "file:../core-data", "@wordpress/data": "file:../data", + "@wordpress/dataviews": "file:../dataviews", "@wordpress/date": "file:../date", "@wordpress/deprecated": "file:../deprecated", "@wordpress/dom": "file:../dom", diff --git a/packages/editor/src/components/post-actions/actions.js b/packages/editor/src/components/post-actions/actions.js index 535e474aafff1..dcd449825fcf4 100644 --- a/packages/editor/src/components/post-actions/actions.js +++ b/packages/editor/src/components/post-actions/actions.js @@ -11,7 +11,7 @@ import { store as noticesStore } from '@wordpress/notices'; import { useMemo, useState } from '@wordpress/element'; import { privateApis as patternsPrivateApis } from '@wordpress/patterns'; import { parse } from '@wordpress/blocks'; - +import { DataForm } from '@wordpress/dataviews'; import { Button, TextControl, @@ -754,32 +754,13 @@ const useDuplicatePostAction = ( postType ) => { } } return ( - +