| 1 |
import { __ } from "@wordpress/i18n"; |
| 2 |
import { PanelBody } from "@wordpress/components"; |
| 3 |
|
| 4 |
import { usePanelBodyContext } from "../../context"; |
| 5 |
import { TabControls } from "../../components"; |
| 6 |
|
| 7 |
import { |
| 8 |
SmartListGeneralTab, |
| 9 |
SmartListStyleTab, |
| 10 |
IconImageGeneralTab, |
| 11 |
IconImageStyleTab, |
| 12 |
ContentGeneralTab, |
| 13 |
ContentStyleTab, |
| 14 |
BadgeGeneralTab, |
| 15 |
BadgeStyleTab, |
| 16 |
} from "./generalTab"; |
| 17 |
import { VisibilityTab, AdvancedTab } from "../shared/advancedTab"; |
| 18 |
|
| 19 |
const Inspector = ({ attributes, setAttributes }) => { |
| 20 |
const { openPanel, togglePanelBody } = usePanelBodyContext(); |
| 21 |
|
| 22 |
return ( |
| 23 |
<> |
| 24 |
<PanelBody |
| 25 |
title={__("General", "post-carousel")} |
| 26 |
opened={openPanel === "general"} |
| 27 |
onToggle={() => togglePanelBody("general")} |
| 28 |
initialOpen={true} |
| 29 |
> |
| 30 |
{openPanel === "general" && ( |
| 31 |
<TabControls |
| 32 |
attributes={attributes} |
| 33 |
setAttributes={setAttributes} |
| 34 |
GeneralTab={SmartListGeneralTab} |
| 35 |
GeneralTabTitle="Basic" |
| 36 |
StyleTab={SmartListStyleTab} |
| 37 |
/> |
| 38 |
)} |
| 39 |
</PanelBody> |
| 40 |
|
| 41 |
<PanelBody |
| 42 |
title={__("Icon / Image", "post-carousel")} |
| 43 |
opened={openPanel === "icon-image"} |
| 44 |
onToggle={() => togglePanelBody("icon-image")} |
| 45 |
> |
| 46 |
{openPanel === "icon-image" && ( |
| 47 |
<TabControls |
| 48 |
attributes={attributes} |
| 49 |
setAttributes={setAttributes} |
| 50 |
GeneralTab={IconImageGeneralTab} |
| 51 |
StyleTab={IconImageStyleTab} |
| 52 |
/> |
| 53 |
)} |
| 54 |
</PanelBody> |
| 55 |
|
| 56 |
<PanelBody |
| 57 |
title={__("Content", "post-carousel")} |
| 58 |
opened={openPanel === "content"} |
| 59 |
onToggle={() => togglePanelBody("content")} |
| 60 |
> |
| 61 |
{openPanel === "content" && ( |
| 62 |
<TabControls |
| 63 |
attributes={attributes} |
| 64 |
setAttributes={setAttributes} |
| 65 |
GeneralTab={ContentGeneralTab} |
| 66 |
StyleTab={ContentStyleTab} |
| 67 |
/> |
| 68 |
)} |
| 69 |
</PanelBody> |
| 70 |
|
| 71 |
<PanelBody |
| 72 |
title={__("Badge", "post-carousel")} |
| 73 |
opened={openPanel === "badge"} |
| 74 |
onToggle={() => togglePanelBody("badge")} |
| 75 |
className="sp-smart-post-list-panel-body" |
| 76 |
> |
| 77 |
{openPanel === "badge" && ( |
| 78 |
<TabControls |
| 79 |
attributes={attributes} |
| 80 |
setAttributes={setAttributes} |
| 81 |
GeneralTab={BadgeGeneralTab} |
| 82 |
StyleTab={BadgeStyleTab} |
| 83 |
/> |
| 84 |
)} |
| 85 |
</PanelBody> |
| 86 |
<PanelBody |
| 87 |
title={__("Advanced", "post-carousel")} |
| 88 |
opened={openPanel === "advance"} |
| 89 |
onToggle={() => togglePanelBody("advance")} |
| 90 |
> |
| 91 |
<TabControls |
| 92 |
attributes={attributes} |
| 93 |
setAttributes={setAttributes} |
| 94 |
displayIcon={false} |
| 95 |
initialTab="visibility" |
| 96 |
VisibilityTab={VisibilityTab} |
| 97 |
AdvancedTab={AdvancedTab} |
| 98 |
/> |
| 99 |
</PanelBody> |
| 100 |
</> |
| 101 |
); |
| 102 |
}; |
| 103 |
|
| 104 |
export default Inspector; |
| 105 |
|