| 1 |
import { __ } from "@wordpress/i18n"; |
| 2 |
import { PanelBody } from "@wordpress/components"; |
| 3 |
|
| 4 |
import { usePanelBodyContext } from "../../context"; |
| 5 |
import { CounterTab, Divider, GeneralTab, ImageTab, QueryBuilderTab } from "./tabs"; |
| 6 |
import { AdvancedStyleTab, TitleStyleTab } from "../shared/styleTab"; |
| 7 |
import { Content } from "./Content"; |
| 8 |
import { ExcerptTab } from "./excerpt"; |
| 9 |
import { TabControls } from "../../components"; |
| 10 |
import { AdvancedTab, VisibilityTab } from "../shared/advancedTab"; |
| 11 |
|
| 12 |
const Inspector = ({ attributes, setAttributes }) => { |
| 13 |
const { openPanel, togglePanelBody } = usePanelBodyContext(); |
| 14 |
const { layout } = attributes; |
| 15 |
|
| 16 |
return ( |
| 17 |
<> |
| 18 |
<PanelBody |
| 19 |
title={__("General", "post-carousel")} |
| 20 |
opened={openPanel === "general"} |
| 21 |
onToggle={() => togglePanelBody("general")} |
| 22 |
> |
| 23 |
<GeneralTab attributes={attributes} setAttributes={setAttributes} /> |
| 24 |
</PanelBody> |
| 25 |
<PanelBody |
| 26 |
title={__("Query Builder", "post-carousel")} |
| 27 |
opened={openPanel === "queryBuilder"} |
| 28 |
onToggle={() => togglePanelBody("queryBuilder")} |
| 29 |
> |
| 30 |
<QueryBuilderTab attributes={attributes} setAttributes={setAttributes} /> |
| 31 |
</PanelBody> |
| 32 |
|
| 33 |
{layout === "taxonomy-layout-one" && ( |
| 34 |
<PanelBody |
| 35 |
title={__("Divider", "post-carousel")} |
| 36 |
opened={openPanel === "divider"} |
| 37 |
onToggle={() => togglePanelBody("divider")} |
| 38 |
> |
| 39 |
<Divider attributes={attributes} setAttributes={setAttributes} /> |
| 40 |
</PanelBody> |
| 41 |
)} |
| 42 |
|
| 43 |
<PanelBody |
| 44 |
title={__("Content Area", "post-carousel")} |
| 45 |
opened={openPanel === "contentArea"} |
| 46 |
onToggle={() => togglePanelBody("contentArea")} |
| 47 |
> |
| 48 |
<Content attributes={attributes} setAttributes={setAttributes} /> |
| 49 |
</PanelBody> |
| 50 |
|
| 51 |
{["taxonomy-layout-five", "taxonomy-layout-six"].includes(layout) && ( |
| 52 |
<PanelBody |
| 53 |
title={__("Image", "post-carousel")} |
| 54 |
opened={openPanel === "image"} |
| 55 |
onToggle={() => togglePanelBody("image")} |
| 56 |
> |
| 57 |
<ImageTab attributes={attributes} setAttributes={setAttributes} /> |
| 58 |
</PanelBody> |
| 59 |
)} |
| 60 |
|
| 61 |
<PanelBody |
| 62 |
title={__("Title", "post-carousel")} |
| 63 |
opened={openPanel === "title"} |
| 64 |
onToggle={() => togglePanelBody("title")} |
| 65 |
> |
| 66 |
<TitleStyleTab attributes={attributes} setAttributes={setAttributes} /> |
| 67 |
</PanelBody> |
| 68 |
|
| 69 |
{!["taxonomy-layout-seven", "taxonomy-layout-eight", "taxonomy-layout-four"].includes(layout) && ( |
| 70 |
<PanelBody |
| 71 |
title={__("Excerpt", "post-carousel")} |
| 72 |
opened={openPanel === "excerpt"} |
| 73 |
onToggle={() => togglePanelBody("excerpt")} |
| 74 |
> |
| 75 |
<ExcerptTab attributes={attributes} setAttributes={setAttributes} /> |
| 76 |
</PanelBody> |
| 77 |
)} |
| 78 |
|
| 79 |
<PanelBody |
| 80 |
title={__("Post Counter", "post-carousel")} |
| 81 |
opened={openPanel === "counter"} |
| 82 |
onToggle={() => togglePanelBody("counter")} |
| 83 |
> |
| 84 |
<CounterTab attributes={attributes} setAttributes={setAttributes} /> |
| 85 |
</PanelBody> |
| 86 |
|
| 87 |
<PanelBody |
| 88 |
title={__("Advanced", "post-carousel")} |
| 89 |
opened={openPanel === "advanced"} |
| 90 |
onToggle={() => togglePanelBody("advanced")} |
| 91 |
> |
| 92 |
<TabControls |
| 93 |
attributes={attributes} |
| 94 |
setAttributes={setAttributes} |
| 95 |
displayIcon={false} |
| 96 |
VisibilityTab={VisibilityTab} |
| 97 |
AdvancedTab={AdvancedTab} |
| 98 |
initialTab="visibility" |
| 99 |
/> |
| 100 |
</PanelBody> |
| 101 |
</> |
| 102 |
); |
| 103 |
}; |
| 104 |
|
| 105 |
export default Inspector; |
| 106 |
|