Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Chrillaz committed Nov 2, 2020
2 parents 1ec7476 + a47aee9 commit 7c6e9ec
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 62 deletions.
10 changes: 9 additions & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
<?php return array('index.js' => array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '3e3431dedc31a36a978dcbe88a15441b'), 'accordion.js' => array('dependencies' => array('wp-polyfill'), 'version' => '787c70681cd515f09219444213a9f808'));
<<<<<<< HEAD
<?php return array('index.js' => array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '3e3431dedc31a36a978dcbe88a15441b'), 'accordion.js' => array('dependencies' => array('wp-polyfill'), 'version' => '787c70681cd515f09219444213a9f808'));
=======
<<<<<<< HEAD
<?php return array('index.js' => array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '436bdb2481a9e4dbe3e29c98d55f57bd'), 'accordion.js' => array('dependencies' => array('wp-polyfill'), 'version' => '954a5ccf99e04153addabfadf70be9cd'));
=======
<?php return array('index.js' => array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '0f087f7516e8a6262ed4945eef8aea01'), 'accordion.js' => array('dependencies' => array('wp-polyfill'), 'version' => '667f7b37f3c5299d2fe9a3111cca5cee'));
>>>>>>> 748fc5c28efc5ed9f991a9eb3463d39c40f8649f
>>>>>>> a47aee9a909a9db0d84cb1bf537e08b971c8f5aa
10 changes: 9 additions & 1 deletion build/index.js

Large diffs are not rendered by default.

13 changes: 1 addition & 12 deletions src/blocks/accordion/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { RadioGroup } from '../../components/radio-group'

export default function Edit( props ) {

const { titleColor, setTitleColor, titleBackground, setTitleBackground, contentBackground, setContentBackground, attributes, setAttributes, mediaControl } = props;
const { titleColor, setTitleColor, titleBackground, setTitleBackground, contentBackground, setContentBackground, attributes, setAttributes } = props;

const [expanded, setExpanded] = useState(false);

Expand Down Expand Up @@ -79,17 +79,6 @@ export default function Edit( props ) {
showIcons={true}
/>
</PanelBody>

<PanelBody
title={ __( 'Mobile View Control' ) }
initialOpen={ true }
>
<ToggleControl
label={__(`${props.attributes.mediaControl ? 'Display' : 'Hide'} on mobile`)}
checked={props.attributes.mediaControl}
onChange={mediaControl => props.setAttributes({ mediaControl })}
/>
</PanelBody>

<PanelColorSettings
title={__('Color settings')}
Expand Down
4 changes: 0 additions & 4 deletions src/blocks/accordion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ export const settings = {
iconAlignment: {
type: 'string',
default: 'right'
},
mediaControl: {
type: 'boolean',
default: true
}
},
edit: withColors({
Expand Down
6 changes: 2 additions & 4 deletions src/blocks/accordion/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@ import { InnerBlocks, RichText, getColorClassName } from '@wordpress/block-edito

export default function save( { attributes } ) {

const { titleColor, titleBackground, contentBackground, mediaControl } = attributes;
const { titleColor, titleBackground, contentBackground } = attributes;

const titleColorClass = titleColor != undefined ? getColorClassName('color', titleColor) : '';

const titleBackgroundClass = titleBackground != undefined ? getColorClassName('background-color', titleBackground) : '';

const contentBackgroundClass = contentBackground != undefined ? getColorClassName('background-color', contentBackground) : '';

const hide = mediaControl ? '' : 'on-media-hide';

return (
<>
<div
id={`#${attributes.anchorContent}`}
className={`noor-block-accordion ${titleBackgroundClass} ${hide}`} aria-expanded={attributes.initialState}
className={`noor-block-accordion ${titleBackgroundClass}`} aria-expanded={attributes.initialState}
>
<RichText.Content
className={`noor-block-accordion__title ${titleColorClass}`}
Expand Down
17 changes: 3 additions & 14 deletions src/blocks/bulletpoint/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { PanelBody, Button, ResponsiveWrapper, __experimentalInputControl as Inp
import { Fragment } from '@wordpress/element'

export default function Edit( props ) {

const {color, setColor, backgroundColor, setBackgroundColor, attributes, setAttributes, className} = props;

const { align, mediaId, mediaControl } = attributes;
const { align, mediaId } = attributes;

const colorClass = color.class != undefined ? color.class : '';

Expand All @@ -29,7 +29,7 @@ export default function Edit( props ) {

const blockStyle = {
backgroundImage: attributes.mediaUrl != '' ? 'url("' + attributes.mediaUrl + '")' : 'none'
};
};

return (
<Fragment>
Expand Down Expand Up @@ -73,17 +73,6 @@ export default function Edit( props ) {
/>}
</PanelBody>

<PanelBody
title={ __( 'Mobile View Control' ) }
initialOpen={ true }
>
<ToggleControl
label={__(`${props.attributes.mediaControl ? 'Display' : 'Hide'} on mobile`)}
checked={props.attributes.mediaControl}
onChange={mediaControl => props.setAttributes({ mediaControl })}
/>
</PanelBody>

<PanelColorSettings
title={__( 'Colot settings' )}
initialOpen={true}
Expand Down
10 changes: 2 additions & 8 deletions src/blocks/bulletpoint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ export const settings = {
mediaUrl: {
type: 'string',
default: ''
},
mediaControl: {
type: 'boolean',
default: true
}
},
edit: compose(
Expand All @@ -54,16 +50,14 @@ export const settings = {
}))( Edit ),
save: ({ attributes }) => {

const {color, backgroundColor, align, mediaControl} = attributes;
const {color, backgroundColor, align} = attributes;

const colorClass = color != undefined ? getColorClassName( 'color', color ) : '';

const backgroundColorClass = backgroundColor != undefined ? getColorClassName('background-color', backgroundColor) : '';

const hide = mediaControl ? '' : 'on-media-hide';

return (
<div className={`noor-block-bullet-point has-align-${align} ${hide}`}>
<div class={`noor-block-bullet-point has-align-${align}`}>
<div className={`noor-block-bullet-point__point ${backgroundColorClass}`}>
{attributes.useMedia && attributes.mediaId != 0
? <img src={attributes.mediaUrl} />
Expand Down
13 changes: 1 addition & 12 deletions src/blocks/google-map/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function Edit ( props ) {

const { attributes, setAttributes } = props;

const { width, height, zoom, address, mediaControl } = attributes;
const { width, height, zoom, address } = attributes;

const getaddress = Object.values(address).filter(line => line != '');

Expand Down Expand Up @@ -75,17 +75,6 @@ export default function Edit ( props ) {
onChange={country => setAttributes({ address: { ...address, country } })}
/>
</PanelBody>

<PanelBody
title={ __( 'Mobile View Control' ) }
initialOpen={ true }
>
<ToggleControl
label={__(`${props.attributes.mediaControl ? 'Display' : 'Hide'} on mobile`)}
checked={props.attributes.mediaControl}
onChange={mediaControl => props.setAttributes({ mediaControl })}
/>
</PanelBody>
</InspectorControls>

<div className="noor-block-google-map" style={styles}>
Expand Down
6 changes: 1 addition & 5 deletions src/blocks/google-map/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,14 @@ export const settings = {
},
src: {
type: 'string'
},
mediaControl: {
type: 'boolean',
default: true
}
},
edit: Edit,
save: ( props ) => {

const {width, height, src } = props.attributes;

props.className = `noor-block-google-map ${props.attributes.mediaControl ? '' : 'on-media-hide'}`;
props.className = 'noor-block-google-map';

return (
<div className={props.className} style={{width: `${width}%`, paddingBottom: `${height}%`}}>
Expand Down
6 changes: 5 additions & 1 deletion src/components/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,8 @@ export const ButtonIconControl = ({ attributes: {useIcon, alignIcon, icon}, setA
/>}
</PanelBody>
);
}
<<<<<<< HEAD
}
=======
}
>>>>>>> a47aee9a909a9db0d84cb1bf537e08b971c8f5aa
4 changes: 4 additions & 0 deletions src/filters/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const attributes = (settings, name) => {
if ( 'core/button' === name ) {

Object.assign(settings.attributes, {
<<<<<<< HEAD
useIcon: {
type: 'boolean',
default: true
Expand All @@ -25,6 +26,9 @@ export const attributes = (settings, name) => {
type: 'string',
default: 'arrow-right-alt'
}
=======
...inlineIconAttributes
>>>>>>> a47aee9a909a9db0d84cb1bf537e08b971c8f5aa
});
}

Expand Down
50 changes: 50 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,56 @@ const registerNoorBlocks = () => [
googleMap
].forEach( block => registerBlock( block ) );

<<<<<<< HEAD
registerNoorBlocks();

const mediaQueryControl = (settings, name) => {

Object.assign(settings.attributes, {
mediaControl: {
type: 'boolean',
default: true
}
});

return settings;
}

const mediaControl = createHigherOrderComponent( BlockEdit => props => {

return (
<Fragment>
<BlockEdit {...props} />

<InspectorControls>
<PanelBody
title={ __( 'Mobile View Control' ) }
initialOpen={ true }
>
<ToggleControl
label={__('Display on mobile')}
checked={props.attributes.mediaControl}
onChange={mediaControl => props.setAttributes({ mediaControl })}
/>
</PanelBody>
</InspectorControls>
</Fragment>
);
}, 'mediaControl');

const mediaExtraProps = ( props, blockType, attributes ) => {

if ( ! attributes.mediaControl ) {

props.className = props.className + ' on-media-hide';
}

return props;
}

// MEDIA DISPLAY SWITCH
=======
>>>>>>> 748fc5c28efc5ed9f991a9eb3463d39c40f8649f
addFilter(
'blocks.registerBlockType',
'noor/gutenberg-blocks/custom-attributes',
Expand Down

0 comments on commit 7c6e9ec

Please sign in to comment.