BlockControls.js
4 years ago
ComponentCSS.js
4 years ago
ContainerContentRenderer.js
3 years ago
GridItem.js
4 years ago
InspectorControls.js
4 years ago
ShapeDividers.js
4 years ago
ShapeDividers.js
34 lines
| 1 | import { Fragment } from '@wordpress/element'; |
| 2 | import classnames from 'classnames'; |
| 3 | import sanitizeSVG from '../../../utils/sanitize-svg'; |
| 4 | |
| 5 | export default ( { attributes, allShapes } ) => { |
| 6 | const { shapeDividers } = attributes; |
| 7 | |
| 8 | return ( |
| 9 | <Fragment> |
| 10 | { !! attributes.shapeDividers.length && |
| 11 | <div className="gb-shapes"> |
| 12 | { |
| 13 | attributes.shapeDividers.map( ( location, index ) => { |
| 14 | const shapeNumber = index + 1; |
| 15 | |
| 16 | return <Fragment key={ index }> |
| 17 | { 'undefined' !== typeof allShapes[ shapeDividers[ index ].shape ] && |
| 18 | <div |
| 19 | className={ classnames( { |
| 20 | 'gb-shape': true, |
| 21 | [ `gb-shape-${ shapeNumber }` ]: true, |
| 22 | } ) } |
| 23 | dangerouslySetInnerHTML={ { __html: sanitizeSVG( allShapes[ shapeDividers[ index ].shape ].icon ) } } |
| 24 | /> |
| 25 | } |
| 26 | </Fragment>; |
| 27 | } ) |
| 28 | } |
| 29 | </div> |
| 30 | } |
| 31 | </Fragment> |
| 32 | ); |
| 33 | }; |
| 34 |