import { __ } from "@wordpress/i18n";
import { Toggle, Layouts, SPRangeControl, SelectField, InputControl } from "../../components";
import useLayouts from "../../hooks/useLayouts";
import { AlignCenter, AlignLeft, AlignRight } from "../../icons/icons";
import { openLinksOptions } from "../../controls/constants";
import SPToggleGroupControl from "../../components/toggleGroupControl/toggleGroupControl";
import { useDeviceType } from "../../controls/controls";
import ProInfo from "../../components/proInfo/proInfo";
export const PostSliderTwoLayoutTab = ({ attributes, setAttributes }) => {
const {
blockName,
postSliderTwoLayout,
postSliderTwoHeight,
contentAreaWidth,
contentAreaHeight,
contentAreaBg,
contentAreaBorder,
liveFilterEnable,
generalLinkOpen,
postSliderGeneralPreloader,
contentAlignment,
postLimit,
carouselArrowSpaceBetween,
carouselArrowBorderRadius,
} = attributes;
const layouts = useLayouts(blockName, postSliderTwoLayout);
const deviceType = useDeviceType();
const layoutChange = (newValue) => {
if (newValue === postSliderTwoLayout) {
return;
}
const layoutDefault = {
"post-slider-two-layout-one": {
contentHorizontalPosition: "center",
contentVerticalPosition: "center",
contentAlignment: "center",
contentAreaWidth: {
...contentAreaWidth,
device: {
...contentAreaWidth.device,
[deviceType]: 580,
},
unit: { ...contentAreaWidth.unit, [deviceType]: "px" },
},
contentAreaHeight: {
...contentAreaHeight,
device: {
...contentAreaHeight.device,
[deviceType]: 280,
},
unit: {
...contentAreaHeight.unit,
[deviceType]: "px",
},
},
contentAreaBg: {
...contentAreaBg,
color: {
...contentAreaBg.color,
solidColor: "#ffffffe6",
},
},
carouselArrowSpaceBetween: {
...carouselArrowSpaceBetween,
device: {
...carouselArrowSpaceBetween.device,
[deviceType]: 100,
},
},
carouselArrowBorderRadius: {
...carouselArrowBorderRadius,
device: {
...carouselArrowBorderRadius.device,
[deviceType]: {
top: 50,
right: 50,
bottom: 50,
left: 50,
},
},
},
},
"post-slider-two-layout-two": {
contentHorizontalPosition: "center",
contentVerticalPosition: "bottom",
contentAlignment: "center",
contentAreaWidth: {
...contentAreaWidth,
device: {
...contentAreaWidth.device,
[deviceType]: 70,
},
unit: { ...contentAreaWidth.unit, [deviceType]: "%" },
},
contentAreaHeight: {
...contentAreaHeight,
device: {
...contentAreaHeight.device,
[deviceType]: 50,
},
unit: {
...contentAreaHeight.unit,
[deviceType]: "%",
},
},
contentAreaBg: {
...contentAreaBg,
color: {
...contentAreaBg.color,
solidColor: "#ffffffe6",
},
},
carouselArrowSpaceBetween: {
...carouselArrowSpaceBetween,
device: {
...carouselArrowSpaceBetween.device,
[deviceType]: 100,
},
},
carouselArrowBorderRadius: {
...carouselArrowBorderRadius,
device: {
...carouselArrowBorderRadius.device,
[deviceType]: {
top: 50,
right: 50,
bottom: 50,
left: 50,
},
},
},
},
"post-slider-two-layout-three": {
contentHorizontalPosition: "right",
contentVerticalPosition: "center",
contentAlignment: "left",
contentAreaWidth: {
...contentAreaWidth,
device: {
...contentAreaWidth.device,
[deviceType]: 60,
},
unit: { ...contentAreaWidth.unit, [deviceType]: "%" },
},
contentAreaHeight: {
...contentAreaHeight,
device: {
...contentAreaHeight.device,
[deviceType]: 280,
},
unit: {
...contentAreaHeight.unit,
[deviceType]: "px",
},
},
contentAreaBg: {
...contentAreaBg,
color: {
...contentAreaBg.color,
solidColor: "#ffffff",
},
},
contentAreaBorder: {
...contentAreaBorder,
style: "solid",
},
carouselArrowSpaceBetween: {
...carouselArrowSpaceBetween,
device: {
...carouselArrowSpaceBetween.device,
Desktop: 0,
Tablet: 0,
Mobile: 0,
},
},
carouselArrowBorderRadius: {
...carouselArrowBorderRadius,
device: {
...carouselArrowBorderRadius.device,
[deviceType]: {
top: 0,
right: 0,
bottom: 0,
left: 0,
},
},
},
},
};
const newData = {
postSliderTwoLayout: newValue,
...layoutDefault?.[newValue],
blockLayoutName: newValue,
};
setAttributes(newData);
};
return (
<>
{layouts?.length > 0 && (
)}
, value: "left" },
{ label: , value: "center" },
{ label: , value: "right" },
]}
/>
Unlock exclusive layouts and advanced display controls. Upgrade to Pro!
>
);
};
export const PostSliderTwoSliderTab = ({ attributes, setAttributes }) => {
const {
carouselAutoPlay,
carouselAutoPlayDelay,
carouselSpeed,
carouselDirection,
postSliderTwoSlideToScroll,
carouselPauseOnHover,
postSliderTwoAnimationEffect,
postSliderTwoAdaptiveHeight,
infiniteLoop,
postSliderTwoTabKeyNavigation,
postSliderTwoMouseWheelControl,
postSliderTwoFreeScrollMode,
// postSliderTwoNavArrow,
// postSliderTwoPaginationDot,
carouselNavArrow,
carouselPaginationDot,
} = attributes;
return (
<>
{carouselAutoPlay && (
)}
>
);
};
export const PostSliderTwoGeneralTab = ({ attributes, setAttributes }) => {
const { generalLinkOpen, postSliderGeneralPreloader, contentAlignment } = attributes;
return (
<>
, value: "left" },
{ label: , value: "center" },
{ label: , value: "right" },
]}
/>
>
);
};