Skip to content

Instantly share code, notes, and snippets.

View aduth's full-sized avatar

Andrew Duthie aduth

View GitHub Profile
@aduth
aduth / stars-block.js
Last active July 12, 2019 18:58 — forked from pento/stars-block.js
Gutenberg Stars Block
( function( blocks, element ) {
var el = element.createElement;
function Stars( { stars } ) {
return el( 'div', { key: 'stars' },
'★'.repeat( stars ),
( ( stars * 2 ) % 2 ) ? '½' : '' );
}
blocks.registerBlockType( 'stars/stars-block', {