jetformbuilder
/
modules
/
framework
/
blocks-style-manager
/
assets
/
src
/
components
/
control-section.jsx
jetformbuilder
/
modules
/
framework
/
blocks-style-manager
/
assets
/
src
/
components
Last commit date
common
3 months ago
controls
3 months ago
control-component.jsx
3 months ago
control-section.jsx
3 months ago
control-stack.jsx
3 months ago
control-section.jsx
31 lines
| 1 | import { PanelBody } from '@wordpress/components'; |
| 2 | import { hasChildren } from '../helpers/utils'; |
| 3 | import ControlComponent from './control-component'; |
| 4 | import { isVisible, getContextFromProps } from '../helpers/conditions-checker'; |
| 5 | |
| 6 | const ControlSection = ( { section, props } ) => { |
| 7 | |
| 8 | if ( section.condition && ! isVisible( section.condition, getContextFromProps( props ) ) ) { |
| 9 | return null; |
| 10 | } |
| 11 | |
| 12 | return ( |
| 13 | <PanelBody |
| 14 | title={ section.title } |
| 15 | initialOpen={ section.initialOpen } |
| 16 | className="crocoblock-style-manager__control-section" |
| 17 | > |
| 18 | { hasChildren( section ) && section.children.map( ( control ) => { |
| 19 | return ( |
| 20 | <ControlComponent |
| 21 | key={ control.id } |
| 22 | control={ control } |
| 23 | props={ props } |
| 24 | /> |
| 25 | ); |
| 26 | } ) } |
| 27 | </PanelBody> |
| 28 | ); |
| 29 | }; |
| 30 | |
| 31 | export default ControlSection; |