@wordpress/primitives
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -12,2 +12,3 @@ import { createElement } from "@wordpress/element"; | ||
import { Children, cloneElement } from '@wordpress/element'; | ||
import { withPreferredColorScheme } from '@wordpress/compose'; | ||
/** | ||
@@ -18,3 +19,5 @@ * Internal dependencies | ||
import styles from './style.scss'; | ||
export var BlockQuotation = function BlockQuotation(props) { | ||
export var BlockQuotation = withPreferredColorScheme(function (props) { | ||
var getStylesFromColorScheme = props.getStylesFromColorScheme; | ||
var blockQuoteStyle = getStylesFromColorScheme(styles.wpBlockQuoteLight, styles.wpBlockQuoteDark); | ||
var newChildren = Children.map(props.children, function (child) { | ||
@@ -29,3 +32,4 @@ if (child && child.props.identifier === 'citation') { | ||
return cloneElement(child, { | ||
tagsToEliminate: ['div'] | ||
tagsToEliminate: ['div'], | ||
style: styles.wpBlockQuoteValue | ||
}); | ||
@@ -37,5 +41,5 @@ } | ||
return createElement(View, { | ||
style: styles.wpBlockQuote | ||
style: blockQuoteStyle | ||
}, newChildren); | ||
}; | ||
}); | ||
//# sourceMappingURL=index.native.js.map |
@@ -14,2 +14,4 @@ "use strict"; | ||
var _compose = require("@wordpress/compose"); | ||
var _style = _interopRequireDefault(require("./style.scss")); | ||
@@ -28,3 +30,6 @@ | ||
*/ | ||
var BlockQuotation = function BlockQuotation(props) { | ||
var BlockQuotation = (0, _compose.withPreferredColorScheme)(function (props) { | ||
var getStylesFromColorScheme = props.getStylesFromColorScheme; | ||
var blockQuoteStyle = getStylesFromColorScheme(_style.default.wpBlockQuoteLight, _style.default.wpBlockQuoteDark); | ||
var newChildren = _element.Children.map(props.children, function (child) { | ||
@@ -39,3 +44,4 @@ if (child && child.props.identifier === 'citation') { | ||
return (0, _element.cloneElement)(child, { | ||
tagsToEliminate: ['div'] | ||
tagsToEliminate: ['div'], | ||
style: _style.default.wpBlockQuoteValue | ||
}); | ||
@@ -48,7 +54,6 @@ } | ||
return (0, _element.createElement)(_reactNative.View, { | ||
style: _style.default.wpBlockQuote | ||
style: blockQuoteStyle | ||
}, newChildren); | ||
}; | ||
}); | ||
exports.BlockQuotation = BlockQuotation; | ||
//# sourceMappingURL=index.native.js.map |
{ | ||
"name": "@wordpress/primitives", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "WordPress cross-platform primitives.", | ||
@@ -27,3 +27,3 @@ "author": "The WordPress Contributors", | ||
"@babel/runtime": "^7.8.3", | ||
"@wordpress/element": "^2.11.0", | ||
"@wordpress/element": "^2.12.0", | ||
"classnames": "^2.2.5" | ||
@@ -34,3 +34,3 @@ }, | ||
}, | ||
"gitHead": "7eb5abd4d6e62e4a8086a4b1d3ba77f0d2e07a91" | ||
"gitHead": "6e2ca778fb69c67188479b491cf2e802011d72e2" | ||
} |
@@ -9,2 +9,3 @@ /** | ||
import { Children, cloneElement } from '@wordpress/element'; | ||
import { withPreferredColorScheme } from '@wordpress/compose'; | ||
/** | ||
@@ -15,3 +16,10 @@ * Internal dependencies | ||
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 ) => { | ||
@@ -24,7 +32,10 @@ if ( child && child.props.identifier === 'citation' ) { | ||
if ( child && child.props.identifier === 'value' ) { | ||
return cloneElement( child, { tagsToEliminate: [ 'div' ] } ); | ||
return cloneElement( child, { | ||
tagsToEliminate: [ 'div' ], | ||
style: styles.wpBlockQuoteValue, | ||
} ); | ||
} | ||
return child; | ||
} ); | ||
return <View style={ styles.wpBlockQuote }>{ newChildren }</View>; | ||
}; | ||
return <View style={ blockQuoteStyle }>{ newChildren }</View>; | ||
} ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
64755
556
1
Updated@wordpress/element@^2.12.0