PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.8
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.8
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / src / blocks / post-timeline-one / generalTab.js

generalTab.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.8, at src/blocks/post-timeline-one/generalTab.js

229 lines 6.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from "@wordpress/i18n";
2 import { Toggle, Layouts, SPRangeControl, SelectField, InputControl } from "../../components";
3 import { openLinksOptions } from "../../controls/constants";
4 import useLayouts from "../../hooks/useLayouts";
5 import ContentOrientations from "../shared/templates/templates-parts/contentOrientations";
6 import { AlignCenter, AlignLeft, AlignRight } from "../../icons/icons";
7 import SPToggleGroupControl from "../../components/toggleGroupControl/toggleGroupControl";
8 import ProInfo from "../../components/proInfo/proInfo";
9
10 export const PostTimelineGeneralTab = ({ attributes, setAttributes }) => {
11 const {
12 itemsPerPage,
13 equalHeightEnable,
14 blockName,
15 generalLinkOpen,
16 gapBetweenPosts,
17 timelineLayout,
18 preloaderEnable,
19 contentOrientation,
20 contentAlignment,
21 postLimit,
22 imagePosition,
23 postCardPadding,
24 postCardBorder,
25 postCardBorderWidth,
26 contentAreaPadding,
27 metaDisplayType,
28 paginationEnable,
29 liveFilterEnable,
30 } = attributes;
31
32 const layouts = useLayouts(blockName, timelineLayout);
33
34 const orientation_five = {
35 postCardPadding: {
36 ...postCardPadding,
37 device: {
38 ...postCardPadding.device,
39 Desktop: {
40 top: 15,
41 right: 15,
42 bottom: 15,
43 left: 15,
44 },
45 },
46 },
47 postCardBorder: { ...postCardBorder, style: "solid" },
48 postCardBorderWidth: {
49 ...postCardBorderWidth,
50 device: {
51 ...postCardBorderWidth.device,
52 Desktop: { top: 1, right: 1, bottom: 1, left: 1 },
53 },
54 },
55 contentAlignment: "left",
56 contentAreaPadding: {
57 ...contentAreaPadding,
58 device: {
59 ...contentAreaPadding.device,
60 Desktop: { top: "", right: "", bottom: "", left: "" },
61 },
62 },
63 };
64 const orientation_other = {
65 postCardPadding: {
66 ...postCardPadding,
67 device: {
68 ...postCardPadding.device,
69 Desktop: { top: "", right: "", bottom: "", left: "" },
70 },
71 },
72 postCardBorder: { ...postCardBorder, style: "none" },
73 contentAlignment: "left",
74 contentAreaPadding: {
75 ...contentAreaPadding,
76 device: {
77 ...contentAreaPadding.device,
78 Desktop: { top: 0, right: 20, bottom: 15, left: 20 },
79 },
80 },
81 };
82
83 const orientationHandler = (newValue) => {
84 if (newValue === contentOrientation) return;
85
86 const cardValue = newValue === "orientation_five" ? orientation_five : orientation_other;
87
88 const newData = {
89 ...cardValue,
90 contentOrientation: newValue,
91 };
92 setAttributes(newData);
93 };
94
95 return (
96 <>
97 <Layouts
98 label={__("Timeline Layout", "post-carousel")}
99 attributes={timelineLayout}
100 attributesKey={"timelineLayout"}
101 setAttributes={setAttributes}
102 displayActive={true}
103 showDemoTitle={true}
104 grid={3}
105 items={layouts}
106 />
107 {imagePosition !== "background" && (
108 <ContentOrientations
109 label={__("Content Orientation", "post-carousel")}
110 attributes={contentOrientation}
111 setAttributes={setAttributes}
112 attributesKey={"contentOrientation"}
113 blockName={blockName}
114 onChange={orientationHandler}
115 />
116 )}
117 <Toggle
118 label={__("Smart Frontend Filter", "post-carousel")}
119 attributes={liveFilterEnable}
120 setAttributes={setAttributes}
121 attributesKey={"liveFilterEnable"}
122 />
123 <Toggle
124 label={__("Smart Pagination", "post-carousel")}
125 attributes={paginationEnable}
126 attributesKey={"paginationEnable"}
127 setAttributes={setAttributes}
128 />
129 <InputControl
130 label={__("Posts Per Page", "post-carousel")}
131 className="sp-smart-limit-field"
132 ajax={true}
133 attributes={postLimit}
134 min={1}
135 max={500}
136 attributesKey={"postLimit"}
137 setAttributes={setAttributes}
138 />
139 <SPRangeControl
140 label={__("Gap Between Posts", "post-carousel")}
141 attributes={gapBetweenPosts}
142 attributesKey={"gapBetweenPosts"}
143 setAttributes={setAttributes}
144 max={150}
145 units={["PX", "%", "EM"]}
146 defaultValue={{ unit: "px", value: 20 }}
147 />
148 <SPToggleGroupControl
149 label={__("Content Alignment", "post-carousel")}
150 attributes={contentAlignment}
151 attributesKey={"contentAlignment"}
152 setAttributes={setAttributes}
153 items={[
154 { label: <AlignLeft />, value: "left" },
155 { label: <AlignCenter />, value: "center" },
156 { label: <AlignRight />, value: "right" },
157 ]}
158 />
159 <SelectField
160 label={__("Link Open In", "post-carousel")}
161 attributes={generalLinkOpen}
162 attributesKey={"generalLinkOpen"}
163 setAttributes={setAttributes}
164 items={openLinksOptions}
165 />
166 <Toggle
167 label={__("Preloader", "post-carousel")}
168 attributes={preloaderEnable}
169 attributesKey={"preloaderEnable"}
170 setAttributes={setAttributes}
171 />
172 <Toggle
173 label={__("Enable Equal Height", "post-carousel")}
174 attributes={equalHeightEnable}
175 attributesKey={"equalHeightEnable"}
176 setAttributes={setAttributes}
177 pro={true}
178 />
179 <ProInfo>
180 <span>Unlock exclusive layouts and advanced display controls.</span> <a href="https://wpsmartpost.com/pricing/?ref=1" target="_blank" rel="noopener noreferrer">Upgrade to Pro!</a>
181 </ProInfo>
182 </>
183 );
184 };
185
186 export const PostTimelineConnectorTab = ({ attributes, setAttributes }) => {
187 const { timelineSize, timelineWidth, timelineHeight, timelineConnectorWidth } = attributes;
188
189 return (
190 <>
191 <div>
192 <strong>Icon Source</strong>
193 </div>
194 <SPRangeControl
195 label={__("Size", "post-carousel")}
196 attributes={timelineSize}
197 attributesKey={"timelineSize"}
198 setAttributes={setAttributes}
199 max={60}
200 defaultValue={{ unit: "px", value: 16 }}
201 />
202 <SPRangeControl
203 label={__("Width", "post-carousel")}
204 attributes={timelineWidth}
205 attributesKey={"timelineWidth"}
206 setAttributes={setAttributes}
207 max={80}
208 defaultValue={{ unit: "px", value: 32 }}
209 />
210 <SPRangeControl
211 label={__("Height", "post-carousel")}
212 attributes={timelineHeight}
213 attributesKey={"timelineHeight"}
214 setAttributes={setAttributes}
215 max={80}
216 defaultValue={{ unit: "px", value: 32 }}
217 />
218 <SPRangeControl
219 label={__("Connector Width", "post-carousel")}
220 attributes={timelineConnectorWidth}
221 attributesKey={"timelineConnectorWidth"}
222 setAttributes={setAttributes}
223 max={20}
224 defaultValue={{ unit: "px", value: 32 }}
225 />
226 </>
227 );
228 };
229