Skip to content

Commit

Permalink
adds simple primary term block for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
psorensen committed Aug 30, 2024
1 parent d7f22be commit fe7390e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
14 changes: 14 additions & 0 deletions example/src/blocks/primary-category/block.json
Original file line number Diff line number Diff line change
@@ -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"
}
12 changes: 12 additions & 0 deletions example/src/blocks/primary-category/edit.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div {...blockProps}>
<PostPrimaryCategory />
</div>
)
};
9 changes: 9 additions & 0 deletions example/src/blocks/primary-category/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { registerBlockType } from '@wordpress/blocks';
import metadata from './block.json';
import { BlockEdit } from './edit';


registerBlockType( metadata, {
edit: BlockEdit,
save: () => null
});

0 comments on commit fe7390e

Please sign in to comment.