desktop.js
5 years ago
main.js
2 years ago
mobile.js
2 years ago
tablet-only.js
5 years ago
tablet.js
2 years ago
tablet.js
60 lines
| 1 | import buildCSS from '../../../utils/build-css'; |
| 2 | import LayoutCSS from '../../../extend/inspector-control/controls/layout/components/LayoutCSS'; |
| 3 | import SizingCSS from '../../../extend/inspector-control/controls/sizing/components/SizingCSS'; |
| 4 | import FlexChildCSS from '../../../extend/inspector-control/controls/flex-child-panel/components/FlexChildCSS'; |
| 5 | import SpacingCSS from '../../../extend/inspector-control/controls/spacing/components/SpacingCSS'; |
| 6 | import TypographyCSS from '../../../extend/inspector-control/controls/typography/components/TypographyCSS'; |
| 7 | import BorderCSS from '../../../extend/inspector-control/controls/borders/BorderCSS'; |
| 8 | |
| 9 | import { |
| 10 | Component, |
| 11 | } from '@wordpress/element'; |
| 12 | |
| 13 | import { |
| 14 | applyFilters, |
| 15 | } from '@wordpress/hooks'; |
| 16 | |
| 17 | export default class TabletCSS extends Component { |
| 18 | render() { |
| 19 | const attributes = applyFilters( 'generateblocks.editor.cssAttrs', this.props.attributes, this.props ); |
| 20 | |
| 21 | const { |
| 22 | uniqueId, |
| 23 | removeText, |
| 24 | hasButtonContainer, |
| 25 | iconStyles, |
| 26 | } = attributes; |
| 27 | |
| 28 | const containerSelector = !! hasButtonContainer ? '.gb-button-wrapper ' : ''; |
| 29 | let selector = '.gb-button-' + uniqueId; |
| 30 | selector = '.editor-styles-wrapper ' + containerSelector + selector; |
| 31 | |
| 32 | let cssObj = []; |
| 33 | |
| 34 | TypographyCSS( cssObj, selector, attributes.typography, 'Tablet' ); |
| 35 | SpacingCSS( cssObj, selector, attributes.spacing, 'Tablet' ); |
| 36 | BorderCSS( cssObj, selector, attributes.borders, 'Tablet' ); |
| 37 | LayoutCSS( cssObj, selector, attributes, 'Tablet' ); |
| 38 | SizingCSS( cssObj, selector, attributes, 'Tablet' ); |
| 39 | FlexChildCSS( cssObj, selector, attributes, 'Tablet' ); |
| 40 | |
| 41 | cssObj[ selector + ' .gb-icon' ] = [ { |
| 42 | 'padding-top': ! removeText ? iconStyles?.paddingTopTablet : null, |
| 43 | 'padding-right': ! removeText ? iconStyles?.paddingRightTablet : null, |
| 44 | 'padding-bottom': ! removeText ? iconStyles?.paddingBottomTablet : null, |
| 45 | 'padding-left': ! removeText ? iconStyles?.paddingLeftTablet : null, |
| 46 | } ]; |
| 47 | |
| 48 | cssObj[ selector + ' .gb-icon svg' ] = [ { |
| 49 | width: iconStyles?.widthTablet, |
| 50 | height: iconStyles?.heightTablet, |
| 51 | } ]; |
| 52 | |
| 53 | cssObj = applyFilters( 'generateblocks.editor.tabletCSS', cssObj, this.props, 'button' ); |
| 54 | |
| 55 | return ( |
| 56 | <style>{ buildCSS( cssObj ) }</style> |
| 57 | ); |
| 58 | } |
| 59 | } |
| 60 |