| 1 |
import { __ } from "@wordpress/i18n"; |
| 2 |
import { PanelBody } from "@wordpress/components"; |
| 3 |
import { TabControls } from "../../components"; |
| 4 |
import { HeadingStyle, StyleTab } from "./styleTab"; |
| 5 |
import { GeneralTab, HeadingTab } from "./generalTab"; |
| 6 |
// import { useState } from "@wordpress/element"; |
| 7 |
import { AdvancedTab, VisibilityTab } from "../shared/advancedTab"; |
| 8 |
import { usePanelBodyContext } from "../../context"; |
| 9 |
|
| 10 |
const Inspector = ({ attributes, setAttributes }) => { |
| 11 |
const { openPanel, togglePanelBody } = usePanelBodyContext(); |
| 12 |
|
| 13 |
return ( |
| 14 |
<> |
| 15 |
<PanelBody |
| 16 |
title={__("Smart Frontend Filter", "post-carousel")} |
| 17 |
initialOpen={true} |
| 18 |
opened={openPanel === "general"} |
| 19 |
onToggle={() => togglePanelBody("general")} |
| 20 |
> |
| 21 |
{openPanel === "general" && ( |
| 22 |
<TabControls |
| 23 |
attributes={attributes} |
| 24 |
setAttributes={setAttributes} |
| 25 |
GeneralTab={GeneralTab} |
| 26 |
StyleTab={StyleTab} |
| 27 |
/> |
| 28 |
)} |
| 29 |
</PanelBody> |
| 30 |
|
| 31 |
{attributes.layout === "layoutTwo" && ( |
| 32 |
<PanelBody |
| 33 |
title={__("Heading", "post-carousel")} |
| 34 |
initialOpen={true} |
| 35 |
opened={openPanel === "heading"} |
| 36 |
onToggle={() => togglePanelBody("heading")} |
| 37 |
> |
| 38 |
{openPanel === "heading" && ( |
| 39 |
<TabControls |
| 40 |
attributes={attributes} |
| 41 |
setAttributes={setAttributes} |
| 42 |
GeneralTab={HeadingTab} |
| 43 |
StyleTab={HeadingStyle} |
| 44 |
/> |
| 45 |
)} |
| 46 |
</PanelBody> |
| 47 |
)} |
| 48 |
|
| 49 |
<PanelBody |
| 50 |
title={__("Advanced", "post-carousel")} |
| 51 |
opened={openPanel === "advance"} |
| 52 |
onToggle={() => togglePanelBody("advance")} |
| 53 |
> |
| 54 |
{openPanel === "advance" && ( |
| 55 |
<TabControls |
| 56 |
attributes={attributes} |
| 57 |
setAttributes={setAttributes} |
| 58 |
GeneralTab={VisibilityTab} |
| 59 |
AdvancedTab={AdvancedTab} |
| 60 |
displayIcon={ false } |
| 61 |
/> |
| 62 |
)} |
| 63 |
</PanelBody> |
| 64 |
</> |
| 65 |
); |
| 66 |
}; |
| 67 |
|
| 68 |
export default Inspector; |
| 69 |
|