Skip to content

Commit

Permalink
Add layout block support
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Dec 20, 2023
1 parent 4f1f895 commit ad739d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"icon": "heart",
"description": "Example block scaffolded with Create Block tool.",
"supports": {
"html": false
"html": false,
"layout": true
},
"textdomain": "like-button",
"editorScript": "file:./index.js",
Expand Down
7 changes: 5 additions & 2 deletions src/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ import { ReactComponent as EmptyHeart } from '../public/images/empty-heart.svg';
*
* @return {WPElement} Element to render.
*/
export default function Edit() {
export default function Edit( {
__unstableLayoutClassNames: layoutClassNames,
} ) {
const blockProps = useBlockProps( { className: layoutClassNames } );
return (
<div {...useBlockProps()}>
<div {...blockProps}>
<div className="like-button">
<EmptyHeart />
<span>Like</span>
Expand Down

0 comments on commit ad739d7

Please sign in to comment.