Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quote left border color in dark mode. #23692

Merged
merged 1 commit into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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