| 1 |
import { __ } from "@wordpress/i18n"; |
| 2 |
import { useState } from "@wordpress/element"; |
| 3 |
import { PanelBody } from "@wordpress/components"; |
| 4 |
import { TabControls } from "../../components"; |
| 5 |
import { ColumnAdvanceAdvancedTab, ColumnAdvancedGeneralTab, ContainerColumnGeneralTab } from "./generalTab"; |
| 6 |
import { ColumnAdvanceVisibilityTab, ContainerColumnStyleTab } from "./styleTab"; |
| 7 |
|
| 8 |
export const Inspector = ({ attributes, setAttributes }) => { |
| 9 |
const [togglePanel, setTogglePanel] = useState("general"); |
| 10 |
|
| 11 |
const toggleHandler = (toggleVal, tabName) => { |
| 12 |
setTogglePanel(toggleVal ? tabName : ""); |
| 13 |
}; |
| 14 |
|
| 15 |
return ( |
| 16 |
<> |
| 17 |
<PanelBody |
| 18 |
title={__("General", "post-carousel")} |
| 19 |
opened={togglePanel === "general"} |
| 20 |
onToggle={(value) => toggleHandler(value, "general")} |
| 21 |
> |
| 22 |
<TabControls |
| 23 |
attributes={attributes} |
| 24 |
setAttributes={setAttributes} |
| 25 |
GeneralTab={ContainerColumnGeneralTab} |
| 26 |
StyleTab={ContainerColumnStyleTab} |
| 27 |
/> |
| 28 |
</PanelBody> |
| 29 |
<PanelBody |
| 30 |
title={__("Advanced", "post-carousel")} |
| 31 |
opened={togglePanel === "advanced"} |
| 32 |
onToggle={(value) => toggleHandler(value, "advanced")} |
| 33 |
> |
| 34 |
<TabControls |
| 35 |
attributes={attributes} |
| 36 |
setAttributes={setAttributes} |
| 37 |
displayIcon={false} |
| 38 |
GeneralTab={ColumnAdvancedGeneralTab} |
| 39 |
VisibilityTab={ColumnAdvanceVisibilityTab} |
| 40 |
AdvancedTab={ColumnAdvanceAdvancedTab} |
| 41 |
/> |
| 42 |
</PanelBody> |
| 43 |
</> |
| 44 |
); |
| 45 |
}; |
| 46 |
|