Skip to content

Commit

Permalink
Move duotone to duotone-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlende committed Sep 1, 2020
1 parent 930da5c commit 117b7a0
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
File renamed without changes.
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

add_action( 'init', function() {
register_block_type( 'a8c/duotone', [
register_block_type( 'a8c/duotone-filter', [
'editor_script' => 'block-experiments',
'style' => 'block-experiments',
'editor_style' => 'block-experiments-editor',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,26 @@ const withDuotoneEditorControls = createHigherOrderComponent(
const duotoneLight = parseColor( attributes.duotoneLight );

useEffect( () => {
setAttributes( { duotoneId: `a8c-duotone-${ instanceId }` } );
setAttributes( {
duotoneId: `a8c-duotone-filter-${ instanceId }`,
} );
}, [ instanceId ] );

return (
<>
<InspectorControls>
<PanelColorSettings
title={ __( 'Duotone', 'duotone' ) }
title={ __( 'Duotone', 'block-experiments' ) }
initialOpen
colorSettings={ [
{
label: __( 'Dark Color', 'duotone' ),
label: __( 'Dark Color', 'block-experiments' ),
value: attributes.duotoneDark,
onChange: ( duotoneDark ) =>
setAttributes( { duotoneDark } ),
},
{
label: __( 'Light Color', 'duotone' ),
label: __( 'Light Color', 'block-experiments' ),
value: attributes.duotoneLight,
onChange: ( duotoneLight ) =>
setAttributes( { duotoneLight } ),
Expand Down Expand Up @@ -151,17 +153,17 @@ function addDuotoneFilterStyle( props, block, attributes ) {
export function registerBlock() {
addFilter(
'editor.BlockEdit',
'a8c/duotone/with-editor-controls',
'a8c/duotone-filter/with-editor-controls',
withDuotoneEditorControls
);
addFilter(
'blocks.registerBlockType',
'a8c/duotone/add-attributes',
'a8c/duotone-filter/add-attributes',
withDuotoneAttributes
);
addFilter(
'blocks.getSaveContent.extraProps',
'a8c/duotone/add-filter-style',
'a8c/duotone-filter/add-filter-style',
addDuotoneFilterStyle
);
}
File renamed without changes.
2 changes: 1 addition & 1 deletion editor.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Import editor styles for blocks
@import './blocks/bauhaus-centenary/editor.scss';
@import './blocks/duotone/editor.scss';
@import './blocks/duotone-filter/editor.scss';
@import './blocks/event/editor.scss';
@import './blocks/layout-grid/editor.scss';
@import './blocks/motion-background/editor.scss';
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ setCategories( [
* Load all our blocks
*/
import * as bauhausCentenaryBlock from '../blocks/bauhaus-centenary/src';
import * as duotoneBlock from '../blocks/duotone/src';
import * as duotoneFilter from '../blocks/duotone-filter/src';
import * as eventBlock from '../blocks/event/src';
import * as layoutGridBlock from '../blocks/layout-grid/src';
import * as motionBackgroundBlock from '../blocks/motion-background/src';
Expand All @@ -32,7 +32,7 @@ import * as wavesBlock from '../blocks/waves/src';

// Instantiate the blocks, adding them to our block category
bauhausCentenaryBlock.registerBlock();
duotoneBlock.registerBlock();
duotoneFilter.registerBlock();
eventBlock.registerBlock();
layoutGridBlock.registerBlock();
motionBackgroundBlock.registerBlock();
Expand Down
2 changes: 1 addition & 1 deletion style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Import front end styles for blocks */
@import './blocks/bauhaus-centenary/style.scss';
@import './blocks/duotone/style.scss';
@import './blocks/duotone-filter/style.scss';
@import './blocks/event/style.scss';
@import './blocks/layout-grid/style.scss';
@import './blocks/motion-background/style.scss';
Expand Down

0 comments on commit 117b7a0

Please sign in to comment.