From fe7390ebd0429bdd2e8e4b7ff326214d45a11157 Mon Sep 17 00:00:00 2001 From: Peter Sorensen Date: Thu, 29 Aug 2024 17:42:53 -0700 Subject: [PATCH] adds simple primary term block for demo --- example/src/blocks/primary-category/block.json | 14 ++++++++++++++ example/src/blocks/primary-category/edit.tsx | 12 ++++++++++++ example/src/blocks/primary-category/index.ts | 9 +++++++++ 3 files changed, 35 insertions(+) create mode 100644 example/src/blocks/primary-category/block.json create mode 100644 example/src/blocks/primary-category/edit.tsx create mode 100644 example/src/blocks/primary-category/index.ts diff --git a/example/src/blocks/primary-category/block.json b/example/src/blocks/primary-category/block.json new file mode 100644 index 00000000..0bb428e0 --- /dev/null +++ b/example/src/blocks/primary-category/block.json @@ -0,0 +1,14 @@ +{ + "apiVersion": 3, + "name": "example/primary-category", + "title": "Post Primary Category", + "icon": "archive", + "category": "common", + "example": {}, + "supports": { + "html": false + }, + "attributes": {}, + "variations": [], + "editorScript": "file:./index.ts" +} \ No newline at end of file diff --git a/example/src/blocks/primary-category/edit.tsx b/example/src/blocks/primary-category/edit.tsx new file mode 100644 index 00000000..ee42fba5 --- /dev/null +++ b/example/src/blocks/primary-category/edit.tsx @@ -0,0 +1,12 @@ +import React from 'react'; +import { useBlockProps } from '@wordpress/block-editor'; +import { PostPrimaryCategory } from '@10up/block-components'; + +export const BlockEdit = ({context}) => { + const blockProps = useBlockProps(); + return ( +
+ +
+ ) +}; \ No newline at end of file diff --git a/example/src/blocks/primary-category/index.ts b/example/src/blocks/primary-category/index.ts new file mode 100644 index 00000000..d06ab1b1 --- /dev/null +++ b/example/src/blocks/primary-category/index.ts @@ -0,0 +1,9 @@ +import { registerBlockType } from '@wordpress/blocks'; +import metadata from './block.json'; +import { BlockEdit } from './edit'; + + +registerBlockType( metadata, { + edit: BlockEdit, + save: () => null +});