| 1 |
import { __ } from "@wordpress/i18n"; |
| 2 |
import { PanelBody } from "@wordpress/components"; |
| 3 |
import { TabControls } from "../../components"; |
| 4 |
import { PaginationGeneralTab } from "../shared/generalTab"; |
| 5 |
import { PaginationStyleTab } from "../shared/styleTab"; |
| 6 |
import { AdvancedTab, VisibilityTab } from "../shared/advancedTab"; |
| 7 |
import { useState } from "@wordpress/element"; |
| 8 |
|
| 9 |
const Inspector = ({ attributes, setAttributes }) => { |
| 10 |
const [openPanel, setOpenPanel] = useState("general"); |
| 11 |
const toggleHandler = (value, panel) => { |
| 12 |
if (value) { |
| 13 |
setOpenPanel(panel); |
| 14 |
} else { |
| 15 |
setOpenPanel(""); |
| 16 |
} |
| 17 |
}; |
| 18 |
|
| 19 |
return ( |
| 20 |
<> |
| 21 |
<PanelBody title={__("Pagination", "post-carousel")} initialOpen={true}> |
| 22 |
{/* <div className="sp-smart-post-single-inspector"> */} |
| 23 |
<TabControls |
| 24 |
attributes={attributes} |
| 25 |
setAttributes={setAttributes} |
| 26 |
GeneralTab={PaginationGeneralTab} |
| 27 |
StyleTab={PaginationStyleTab} |
| 28 |
/> |
| 29 |
{/* </div> */} |
| 30 |
</PanelBody> |
| 31 |
<PanelBody |
| 32 |
title={__("Advanced", "post-carousel")} |
| 33 |
opened={openPanel === "advance"} |
| 34 |
onToggle={(value) => toggleHandler(value, "advance")} |
| 35 |
> |
| 36 |
<TabControls |
| 37 |
attributes={attributes} |
| 38 |
setAttributes={setAttributes} |
| 39 |
GeneralTab={VisibilityTab} |
| 40 |
AdvancedTab={AdvancedTab} |
| 41 |
/> |
| 42 |
</PanelBody> |
| 43 |
</> |
| 44 |
); |
| 45 |
}; |
| 46 |
|
| 47 |
export default Inspector; |
| 48 |
|