index.js
39 lines
| 1 | /** |
| 2 | * Internal dependencies |
| 3 | */ |
| 4 | import { TitleArea } from './title-area'; |
| 5 | import { BodyArea } from './body-area'; |
| 6 | |
| 7 | export const Item = ({ |
| 8 | activeBlockType, |
| 9 | index, |
| 10 | onChange, |
| 11 | blockStyleListObj, |
| 12 | openNameLists, |
| 13 | setOpenNameLists, |
| 14 | array, |
| 15 | }) => { |
| 16 | const isOpen = openNameLists.includes(blockStyleListObj.property_name); |
| 17 | |
| 18 | return ( |
| 19 | <div className="custom_block_style_item"> |
| 20 | <TitleArea |
| 21 | activeBlockType={activeBlockType} |
| 22 | index={index} |
| 23 | blockStyleListObj={blockStyleListObj} |
| 24 | openNameLists={openNameLists} |
| 25 | setOpenNameLists={setOpenNameLists} |
| 26 | array={array} |
| 27 | /> |
| 28 | {isOpen && ( |
| 29 | <BodyArea |
| 30 | activeBlockType={activeBlockType} |
| 31 | index={index} |
| 32 | onChange={onChange} |
| 33 | blockStyleListObj={blockStyleListObj} |
| 34 | /> |
| 35 | )} |
| 36 | </div> |
| 37 | ); |
| 38 | }; |
| 39 |