Skip to content

Commit

Permalink
Rename mergedStyle to style
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerardo Pacheco committed Jul 6, 2021
1 parent bb32cd8 commit ed6e9d2
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function BlockForType( {
// Block level styles
wrapperProps={ wrapperProps }
// inherited styles merged with block level styles
mergedStyle={ mergedStyle }
style={ mergedStyle }
clientId={ clientId }
parentWidth={ parentWidth }
contentStyle={ contentStyle }
Expand Down
17 changes: 8 additions & 9 deletions packages/block-library/src/button/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class ButtonEdit extends Component {
}

getBackgroundColor() {
const { attributes, colors, gradients, mergedStyle } = this.props;
const { attributes, colors, gradients, style } = this.props;
const { backgroundColor, gradient } = attributes;

// Return named gradient value if available.
Expand All @@ -207,13 +207,13 @@ class ButtonEdit extends Component {
colorObject?.color ||
colorProps.style?.backgroundColor ||
colorProps.style?.background ||
mergedStyle?.backgroundColor ||
style?.backgroundColor ||
styles.defaultButton.backgroundColor
);
}

getTextColor() {
const { attributes, colors, mergedStyle } = this.props;
const { attributes, colors, style } = this.props;
const colorProps = getColorClassesAndStyles( attributes );

// Retrieve named color object to force inline styles for themes that
Expand All @@ -226,7 +226,7 @@ class ButtonEdit extends Component {
return (
colorObject?.color ||
colorProps.style?.color ||
mergedStyle?.color ||
style?.color ||
styles.defaultButton.color
);
}
Expand Down Expand Up @@ -377,12 +377,12 @@ class ButtonEdit extends Component {
mergeBlocks,
parentWidth,
setAttributes,
mergedStyle,
style,
} = this.props;
const {
placeholder,
text,
style,
style: buttonStyle,
url,
align = 'center',
width,
Expand All @@ -394,7 +394,7 @@ class ButtonEdit extends Component {
return null;
}

const borderRadius = style?.border?.radius;
const borderRadius = buttonStyle?.border?.radius;

const borderRadiusValue = Number.isInteger( borderRadius )
? borderRadius
Expand Down Expand Up @@ -466,8 +466,7 @@ class ButtonEdit extends Component {
} }
textAlign={ align }
placeholderTextColor={
mergedStyle?.color ||
styles.placeholderTextColor.color
style?.color || styles.placeholderTextColor.color
}
identifier="text"
tagName="p"
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/columns/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ const ColumnsEditContainerWrapper = withDispatch(
)( memo( ColumnsEditContainer ) );

const ColumnsEdit = ( props ) => {
const { clientId, isSelected, mergedStyle } = props;
const { clientId, isSelected, style } = props;
const {
columnCount,
isDefaultColumns,
Expand Down Expand Up @@ -505,7 +505,7 @@ const ColumnsEdit = ( props ) => {
}, [] );

return (
<View style={ mergedStyle }>
<View style={ style }>
<ColumnsEditContainerWrapper
columnCount={ columnCount }
innerWidths={ memoizedInnerWidths }
Expand Down
8 changes: 4 additions & 4 deletions packages/block-library/src/group/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function GroupEdit( {
isSelected,
isLastInnerBlockSelected,
getStylesFromColorScheme,
mergedStyle,
style,
blockWidth,
} ) {
const { align } = attributes;
Expand Down Expand Up @@ -79,13 +79,13 @@ function GroupEdit( {
<View
style={ [
isSelected && hasInnerBlocks && styles.innerBlocks,
mergedStyle,
style,
isSelected &&
hasInnerBlocks &&
mergedStyle?.backgroundColor &&
style?.backgroundColor &&
styles.hasBackgroundAppender,
isLastInnerBlockSelected &&
mergedStyle?.backgroundColor &&
style?.backgroundColor &&
styles.isLastInnerBlockSelected,
] }
>
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/heading/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function HeadingEdit( {
setAttributes,
mergeBlocks,
onReplace,
mergedStyle,
style,
clientId,
} ) {
const { textAlign, content, level, placeholder } = attributes;
Expand All @@ -34,7 +34,7 @@ function HeadingEdit( {
className: classnames( {
[ `has-text-align-${ textAlign }` ]: textAlign,
} ),
style: mergedStyle,
style,
} );

return (
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function ListEdit( {
setAttributes,
mergeBlocks,
onReplace,
mergedStyle,
style,
} ) {
const { ordered, values, type, reversed, start, placeholder } = attributes;
const tagName = ordered ? 'ol' : 'ul';
Expand Down Expand Up @@ -134,7 +134,7 @@ export default function ListEdit( {
);

const blockProps = useBlockProps( {
style: mergedStyle,
style,
} );

return (
Expand Down
7 changes: 3 additions & 4 deletions packages/block-library/src/media-text/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class MediaTextEdit extends Component {
setAttributes,
isSelected,
isRTL,
mergedStyle,
style,
blockWidth,
} = this.props;
const {
Expand Down Expand Up @@ -285,7 +285,7 @@ class MediaTextEdit extends Component {
? styles.innerBlockStackMediaLeft
: styles.innerBlockStackMediaRight ),
},
( mergedStyle?.backgroundColor || backgroundColor.color ) &&
( style?.backgroundColor || backgroundColor.color ) &&
styles.innerBlockPaddings,
];

Expand All @@ -302,8 +302,7 @@ class MediaTextEdit extends Component {
? styles[ 'is-stacked-on-mobile.has-media-on-the-right' ]
: {} ),
...( isSelected && styles[ 'is-selected' ] ),
backgroundColor:
mergedStyle?.backgroundColor || backgroundColor.color,
backgroundColor: style?.backgroundColor || backgroundColor.color,
paddingBottom: 0,
};

Expand Down
11 changes: 4 additions & 7 deletions packages/block-library/src/paragraph/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ function ParagraphBlock( {
mergeBlocks,
onReplace,
setAttributes,
mergedStyle,
style,
clientId,
} ) {
Expand All @@ -30,13 +29,11 @@ function ParagraphBlock( {
const { align, content, placeholder } = attributes;

const styles = {
...( mergedStyle?.baseColors && {
color: mergedStyle.baseColors?.color?.text,
placeholderColor:
mergedStyle.color || mergedStyle.baseColors?.color?.text,
linkColor: mergedStyle.baseColors?.elements?.link?.color?.text,
...( style?.baseColors && {
color: style.baseColors?.color?.text,
placeholderColor: style.color || style.baseColors?.color?.text,
linkColor: style.baseColors?.elements?.link?.color?.text,
} ),
...mergedStyle,
...style,
};

Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/quote/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ export default function QuoteEdit( {
onReplace,
className,
insertBlocksAfter,
mergedStyle,
style,
} ) {
const { align, value, citation } = attributes;
const blockProps = useBlockProps( {
className: classnames( className, {
[ `has-text-align-${ align }` ]: align,
} ),
style: mergedStyle,
style,
} );

return (
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/verse/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export default function VerseEdit( {
setAttributes,
mergeBlocks,
onRemove,
mergedStyle,
style,
} ) {
const { textAlign, content } = attributes;
const blockProps = useBlockProps( {
className: classnames( {
[ `has-text-align-${ textAlign }` ]: textAlign,
} ),
style: mergedStyle,
style,
} );

return (
Expand Down

0 comments on commit ed6e9d2

Please sign in to comment.