/** * BLOCK: Atomic Blocks Sharing */ // Import block dependencies and components import classnames from 'classnames'; import Inspector from './components/inspector'; import ShareLinks from './components/sharing'; // Import CSS import './styles/style.scss'; import './styles/editor.scss'; // Components const { __ } = wp.i18n; // Extend component const { Component } = wp.element; // Register block const { registerBlockType } = wp.blocks; // Register editor components const { RichText, AlignmentToolbar, BlockControls, BlockAlignmentToolbar, } = wp.editor; // Register components const { Button, withFallbackStyles, IconButton, Dashicon, } = wp.components; // Register the block registerBlockType( 'atomic-blocks/ab-sharing', { title: __( 'AB Sharing', 'atomic-blocks' ), description: __( 'Add sharing buttons to your posts and pages.', 'atomic-blocks' ), icon: 'admin-links', category: 'atomic-blocks', keywords: [ __( 'sharing', 'atomic-blocks' ), __( 'social', 'atomic-blocks' ), __( 'atomic', 'atomic-blocks' ), ], // Render the block components edit: props => { // Setup the props const { attributes, isSelected, editable, className, setAttributes } = props; const { twitter, facebook, google, linkedin, pinterest, email, reddit, shareAlignment, shareButtonStyle, shareButtonShape, shareButtonColor, } = props.attributes; return [ // Show the alignment toolbar on focus { setAttributes( { shareAlignment: value } ); } } /> , // Show the block controls on focus , // Show the button markup in the editor ]; }, // Render via PHP save() { return null; }, } );