Skip to content

Commit

Permalink
Some conflict resolution in cover block's index.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersonrabb committed Jan 16, 2019
1 parent 021888c commit ded1017
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions packages/block-library/src/cover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
withColors,
getColorClassName,
} from '@wordpress/editor';
import { has } from 'lodash';

const blockAttributes = {
title: {
Expand Down Expand Up @@ -238,19 +237,10 @@ export const settings = {
backgroundColor: overlayColor.color,
};

if ( ! hasParallax && validFocalPoint( focalPoint ) ) {
if ( focalPoint ) {
style.backgroundPosition = `${ focalPoint.x * 100 }% ${ focalPoint.y * 100 }%`;
}

const classes = classnames(
className,
contentAlign !== 'center' && `has-${ contentAlign }-content`,
dimRatioToClass( dimRatio ),
{
'has-background-dim': dimRatio !== 0,
'has-parallax': hasParallax,
}
);
const controls = (
<Fragment>
<BlockControls>
Expand Down Expand Up @@ -292,7 +282,7 @@ export const settings = {
onChange={ toggleParallax }
/>
) }
{ IMAGE_BACKGROUND_TYPE === backgroundType && ! hasParallax && validDimensions( dimensions ) && (
{ IMAGE_BACKGROUND_TYPE === backgroundType && ! hasParallax && (
<FocalPointPicker
label={ __( 'Focal Point Picker' ) }
url={ url }
Expand Down Expand Up @@ -419,7 +409,7 @@ export const settings = {
if ( ! overlayColorClass ) {
style.backgroundColor = customOverlayColor;
}
if ( ! hasParallax && validFocalPoint( focalPoint ) ) {
if ( focalPoint && ! hasParallax ) {
style.backgroundPosition = `${ focalPoint.x * 100 }% ${ focalPoint.y * 100 }%`;
}

Expand Down Expand Up @@ -534,11 +524,3 @@ function backgroundImageStyles( url ) {
{ backgroundImage: `url(${ url })` } :
{};
}

function validFocalPoint( focalPoint ) {
return ( focalPoint && has( focalPoint, [ 'x' ] ) && has( focalPoint, [ 'y' ] ) );
}

function validDimensions( dimensions ) {
return ( dimensions && has( dimensions, [ 'height' ] ) && has( dimensions, [ 'width' ] ) );
}

0 comments on commit ded1017

Please sign in to comment.