inspector-controls
4 years ago
AlignmentControls.js
4 years ago
AnchorTag.js
4 years ago
BlockControls.js
4 years ago
ComponentCSS.js
4 years ago
Image.js
4 years ago
ImageContentRenderer.js
3 years ago
ImagePlaceholder.js
4 years ago
InspectorControls.js
4 years ago
InspectorControls.js
88 lines
| 1 | import { InspectorControls } from '@wordpress/block-editor'; |
| 2 | import PanelArea from '../../../components/panel-area'; |
| 3 | import DimensionsGroup from '../../../components/dimensions-group'; |
| 4 | import ColorGroup from '../../../components/color-group'; |
| 5 | import getIcon from '../../../utils/get-icon'; |
| 6 | import { __ } from '@wordpress/i18n'; |
| 7 | import ImageSettingsControls from './inspector-controls/ImageSettingsControl'; |
| 8 | |
| 9 | export default function ImageInspectorControls( props ) { |
| 10 | const { |
| 11 | state, |
| 12 | deviceType, |
| 13 | } = props; |
| 14 | |
| 15 | return ( |
| 16 | <InspectorControls> |
| 17 | <ImageSettingsControls { ...props } /> |
| 18 | |
| 19 | <PanelArea |
| 20 | { ...props } |
| 21 | title={ __( 'Spacing', 'generateblocks' ) } |
| 22 | initialOpen={ false } |
| 23 | icon={ getIcon( 'spacing' ) } |
| 24 | className={ 'gblocks-panel-label' } |
| 25 | id={ 'imageSpacing' } |
| 26 | state={ state } |
| 27 | > |
| 28 | <DimensionsGroup |
| 29 | { ...props } |
| 30 | deviceType={ deviceType } |
| 31 | dimensions={ |
| 32 | [ |
| 33 | { |
| 34 | type: 'padding', |
| 35 | label: __( 'Padding', 'generateblocks' ), |
| 36 | units: [ 'px', 'em', '%' ], |
| 37 | }, |
| 38 | { |
| 39 | type: 'margin', |
| 40 | label: __( 'Margin', 'generateblocks' ), |
| 41 | units: [ 'px', 'em', '%' ], |
| 42 | }, |
| 43 | { |
| 44 | type: 'borderSize', |
| 45 | label: __( 'Border Size', 'generateblocks' ), |
| 46 | units: [ 'px' ], |
| 47 | }, |
| 48 | { |
| 49 | type: 'borderRadius', |
| 50 | label: __( 'Border Radius', 'generateblocks' ), |
| 51 | units: [ 'px', 'em', '%' ], |
| 52 | }, |
| 53 | ] |
| 54 | } |
| 55 | /> |
| 56 | </PanelArea> |
| 57 | |
| 58 | <PanelArea |
| 59 | { ...props } |
| 60 | title={ __( 'Colors', 'generateblocks' ) } |
| 61 | initialOpen={ false } |
| 62 | icon={ getIcon( 'colors' ) } |
| 63 | className={ 'gblocks-panel-label' } |
| 64 | id={ 'imageColors' } |
| 65 | state={ state } |
| 66 | > |
| 67 | <ColorGroup |
| 68 | { ...props } |
| 69 | colors={ |
| 70 | [ |
| 71 | { |
| 72 | group: 'border', |
| 73 | label: __( 'Border', 'generateblocks' ), |
| 74 | items: [ |
| 75 | { |
| 76 | attribute: 'borderColor', |
| 77 | alpha: true, |
| 78 | }, |
| 79 | ], |
| 80 | }, |
| 81 | ] |
| 82 | } |
| 83 | /> |
| 84 | </PanelArea> |
| 85 | </InspectorControls> |
| 86 | ); |
| 87 | } |
| 88 |