Skip to content

Instantly share code, notes, and snippets.

@markhowellsmead
Created June 9, 2021 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markhowellsmead/c254c68cf5eaa15b287aa8766ec660d9 to your computer and use it in GitHub Desktop.
Save markhowellsmead/c254c68cf5eaa15b287aa8766ec660d9 to your computer and use it in GitHub Desktop.
Tabs with content block
import { __, _x } from '@wordpress/i18n';
import { InnerBlocks } from '@wordpress/block-editor';
import { registerBlockType } from '@wordpress/blocks';
import { group as icon } from '@wordpress/icons';
registerBlockType('sht/tabswithcontent', {
title: __('Reitergruppe', 'sha'),
description: __(
'Eine Reitergruppe beinhaltet mehrere Reiter, um Inhalt auf der Website zu gruppieren.',
'sha'
),
icon,
category: 'sht/blocks',
supports: {
group: false,
mode: false,
html: false,
},
edit: () => {
return [
<div className='b-tabswithcontent'>
<div className='b-tabswithcontent__inner' data-tabswithcontent-inner>
<InnerBlocks
allowedBlocks={['sht/tabwithcontent']}
template={[['sht/tabwithcontent']]}
/>
</div>
</div>,
];
},
save() {
return (
<div className='b-tabswithcontent' data-tabswithcontent>
<div className='b-tabswithcontent__inner' data-tabswithcontent-inner>
<InnerBlocks.Content />
</div>
</div>
);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment