Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function ResponsiveWrapper( { naturalWidth, naturalHeight, children } ) {
if ( Children.count( children ) !== 1 ) {
return null;
}
const imageStyle = {
paddingBottom: ( naturalHeight / naturalWidth * 100 ) + '%',
};
return (
<div>
<div style="{">
{ cloneElement( children, {
className: classnames( 'components-responsive-wrapper__content', children.props.className ),
} ) }
</div>
);
}
</div>
function Tiles( props ) {
const {
columns,
children,
spacing = 10,
style,
} = props;
const { compose } = StyleSheet;
const tileCount = Children.count( children );
const lastTile = tileCount - 1;
const lastRow = Math.floor( lastTile / columns );
const wrappedChildren = Children.map( children, ( child, index ) => {
/** Since we don't have `calc()`, we must calculate our spacings here in
* order to preserve even spacing between tiles and equal width for tiles
* in a given row.
*
* In order to ensure equal sizing of tile contents, we distribute the
* spacing such that each tile has an equal "share" of the fixed spacing. To
* keep the tiles properly aligned within their rows, we calculate the left
* and right paddings based on the tile's relative position within the row.
*
* Note: we use padding instead of margins so that the fixed spacing is
* included within the relative spacing (i.e. width percentage), and
* wrapping behavior is preserved.
function Warning( { className, actions, children, secondaryActions } ) {
return (
<div>
<div>
<p>{ children }</p>
{ Children.count( actions ) > 0 && (
<div>
{ Children.map( actions, ( action, i ) => (
<span>
{ action }
</span>
) ) }
</div>
) }
</div>
{ secondaryActions && (
(
</div>
emitToChild( eventName, event ) {
const { children } = this.props;
if ( Children.count( children ) !== 1 ) {
return;
}
const child = Children.only( children );
if ( typeof child.props[ eventName ] === 'function' ) {
child.props[ eventName ]( event );
}
}
export const getChildren = ( props ) => {
return props.hasOwnProperty( 'children' ) &&
Children.count( props.children ) ?
Children.toArray( props.children ) :
[];
};
function Warning( { actions, children } ) {
return (
<div>
<div>
<p>{ children }</p>
{ Children.count( actions ) > 0 && (
<div>
{ Children.map( actions, ( action, i ) => (
<span>
{ action }
</span>
) ) }
</div>
) }
</div>
</div>
);
}
export function MenuGroup( {
children,
className = '',
label,
} ) {
const instanceId = useInstanceId( MenuGroup );
if ( ! Children.count( children ) ) {
return null;
}
const labelId = `components-menu-group-label-${ instanceId }`;
const classNames = classnames(
className,
'components-menu-group'
);
return (
<div>
{ label &&
</div>
injectContextIntoChildren( cssPath, children ) {
const siblingCount = Children.count( children );
return Children.map( children, ( child, siblingPosition ) => {
return cloneElement( child, { siblingCount, siblingPosition, ancestorPath: cssPath } );
} );
}