Skip to content

Commit

Permalink
Fix quote left border color in dark mode. (#23692)
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioEstevao committed Jul 6, 2020
1 parent ef84636 commit f47037a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
13 changes: 10 additions & 3 deletions packages/primitives/src/block-quotation/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ import { View } from 'react-native';
* WordPress dependencies
*/
import { Children, cloneElement } from '@wordpress/element';
import { withPreferredColorScheme } from '@wordpress/compose';
/**
* Internal dependencies
*/
import styles from './style.scss';

export const BlockQuotation = ( props ) => {
export const BlockQuotation = withPreferredColorScheme( ( props ) => {
const { getStylesFromColorScheme } = props;

const blockQuoteStyle = getStylesFromColorScheme(
styles.wpBlockQuoteLight,
styles.wpBlockQuoteDark
);
const newChildren = Children.map( props.children, ( child ) => {
if ( child && child.props.identifier === 'citation' ) {
return cloneElement( child, {
Expand All @@ -23,5 +30,5 @@ export const BlockQuotation = ( props ) => {
}
return child;
} );
return <View style={ styles.wpBlockQuote }>{ newChildren }</View>;
};
return <View style={ blockQuoteStyle }>{ newChildren }</View>;
} );
13 changes: 11 additions & 2 deletions packages/primitives/src/block-quotation/style.native.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
.wpBlockQuote {
%wpBlockQuote-shared {
border-left-width: 4px;
border-left-color: $black;
border-left-style: solid;
padding-left: 8px;
margin-left: 0;
}

.wpBlockQuoteLight {
@extend %wpBlockQuote-shared;
border-left-color: $black;
}

.wpBlockQuoteDark {
@extend %wpBlockQuote-shared;
border-left-color: $white;
}

.wpBlockQuoteCitation {
margin-top: 16px;
font-size: 14px;
Expand Down

0 comments on commit f47037a

Please sign in to comment.