desktop.js
4 years ago
main.js
4 years ago
mobile.js
4 years ago
tablet-only.js
4 years ago
tablet.js
4 years ago
main.js
45 lines
| 1 | import buildCSS from '../../../utils/build-css'; |
| 2 | import shorthandCSS from '../../../utils/shorthand-css'; |
| 3 | import flexboxAlignment from '../../../utils/flexbox-alignment'; |
| 4 | |
| 5 | import { |
| 6 | Component, |
| 7 | } from '@wordpress/element'; |
| 8 | |
| 9 | import { |
| 10 | applyFilters, |
| 11 | } from '@wordpress/hooks'; |
| 12 | |
| 13 | export default class MainCSS extends Component { |
| 14 | render() { |
| 15 | const attributes = applyFilters( 'generateblocks.editor.cssAttrs', this.props.attributes, this.props ); |
| 16 | |
| 17 | const { |
| 18 | uniqueId, |
| 19 | alignment, |
| 20 | marginTop, |
| 21 | marginRight, |
| 22 | marginBottom, |
| 23 | marginLeft, |
| 24 | marginUnit, |
| 25 | } = attributes; |
| 26 | |
| 27 | let cssObj = []; |
| 28 | |
| 29 | cssObj[ '.gb-button-wrapper-' + uniqueId ] = [ { |
| 30 | 'margin': shorthandCSS( marginTop, marginRight, marginBottom, marginLeft, marginUnit ), // eslint-disable-line quote-props |
| 31 | 'justify-content': flexboxAlignment( alignment ), |
| 32 | } ]; |
| 33 | |
| 34 | cssObj[ '.gb-button-wrapper-' + uniqueId + ' > .block-editor-inner-blocks > .block-editor-block-list__layout' ] = [ { |
| 35 | 'justify-content': flexboxAlignment( alignment ), |
| 36 | } ]; |
| 37 | |
| 38 | cssObj = applyFilters( 'generateblocks.editor.mainCSS', cssObj, this.props, 'button-container' ); |
| 39 | |
| 40 | return ( |
| 41 | <style>{ buildCSS( cssObj ) }</style> |
| 42 | ); |
| 43 | } |
| 44 | } |
| 45 |