Last active
March 5, 2020 05:41
-
-
Save torounit/d19318086b7ed616c5733ef9d2bc8dae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { registerBlockType } from '@wordpress/blocks'; | |
import { InnerBlocks } from '@wordpress/block-editor'; | |
import { __ } from '@wordpress/i18n'; | |
registerBlockType( 'my/card', { | |
attributes: {}, | |
category: 'layout', | |
supports: { | |
anchor: true, | |
}, | |
icon: () => ( | |
<svg | |
xmlns="http://www.w3.org/2000/svg" | |
height="24" | |
viewBox="0 0 24 24" | |
width="24" | |
> | |
<path d="M0 0h24v24H0z" fill="none" /> | |
<path d="M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H6V6h12v12z" /> | |
</svg> | |
), | |
title: __( 'card', 'my' ), | |
edit: ( { className } ) => { | |
return ( | |
<div className={ className }> | |
<div className="wp-block-my-card__inner"> | |
<InnerBlocks /> | |
</div> | |
</div> | |
); | |
}, | |
save: () => { | |
return ( | |
<div> | |
<div className="wp-block-my-card__inner"> | |
<InnerBlocks.Content /> | |
</div> | |
</div> | |
); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment