import { __ } from "@wordpress/i18n"; import { Toggle, Layouts, SPRangeControl, SelectField, TabControls, Background, InputControl } from "../../components"; import { openLinksOptions } from "../../controls/constants"; import useLayouts from "../../hooks/useLayouts"; import { getPaginationBlock } from "../shared/helpFn"; import { AlignCenter, AlignLeft, AlignRight } from "../../icons/icons"; import SPToggleGroupControl from "../../components/toggleGroupControl/toggleGroupControl"; import { BgIcon, GradientIcon } from "../../components/background/svgIcon"; import { useMemo } from "@wordpress/element"; import { useDeviceType } from "../../controls/controls"; import ProInfo from "../../components/proInfo/proInfo"; export const PostListGeneralTab = ({ attributes, setAttributes }) => { const { itemsPerPage, equalHeightEnable, blockName, generalLinkOpen, verticalGap, postListLayout, preloaderEnable, contentAlignment, postLimit, metaDisplayType, paginationEnable, contentAreaPadding, imageHeight, imageWidth, postCardBorder, contentAreaBorder, liveFilterEnable, clientId, } = attributes; const layouts = useLayouts(blockName, postListLayout); const deviceType = useDeviceType(); const layoutsObject = useMemo(() => { const typeOne = { imageWidth: { ...imageWidth, device: { ...imageWidth.device, [deviceType]: 364, }, unit: { ...imageWidth.unit, [deviceType]: "px", }, }, imageHeight: { ...imageHeight, device: { ...imageHeight.device, [deviceType]: 244, }, }, contentVerticalPosition: "top", contentAreaBorder: { ...contentAreaBorder, style: "none" }, contentAreaPadding: { ...contentAreaPadding, device: { ...contentAreaPadding.device, Desktop: { ...contentAreaPadding.device.Desktop, top: 15, right: 0, bottom: 0, left: 0, }, }, }, showHideDivider: true, }; const typeTwo = { imageWidth: { ...imageWidth, device: { ...imageWidth.device, [deviceType]: 446, }, unit: { ...imageWidth.unit, [deviceType]: "px", }, }, imageHeight: { ...imageHeight, device: { ...imageHeight.device, [deviceType]: 298, }, }, contentVerticalPosition: "center", contentAreaBorder: { ...contentAreaBorder, style: "solid" }, contentAreaPadding: { ...contentAreaPadding, device: { ...contentAreaPadding.device, Desktop: { ...contentAreaPadding.device.Desktop, top: 15, right: 15, bottom: 15, left: 15, }, }, }, showHideDivider: false, }; const typeThree = { imageWidth: { ...imageWidth, device: { ...imageWidth.device, [deviceType]: 364, }, unit: { ...imageWidth.unit, [deviceType]: "px", }, }, imageHeight: { ...imageHeight, device: { ...imageHeight.device, [deviceType]: 220, }, }, contentVerticalPosition: "top", contentAreaBorder: { ...contentAreaBorder, style: "none" }, contentAreaPadding: { ...contentAreaPadding, device: { ...contentAreaPadding.device, Desktop: { ...contentAreaPadding.device.Desktop, top: 15, right: 0, bottom: 0, left: 0, }, }, }, showHideDivider: true, }; const updatedObject = { "list-one-layout-one": typeOne, "list-one-layout-two": typeOne, "list-one-layout-three": typeTwo, "list-one-layout-four": typeTwo, "list-one-layout-five": typeThree, "list-one-layout-six": typeThree, }; return updatedObject; }, []); const layoutsChangeHandler = (newValue) => { if (postListLayout === newValue) { return; } const updatedWidthHeight = layoutsObject[newValue]; const updatedAttributes = { postListLayout: newValue, ...updatedWidthHeight, }; // Apply all updates at once setAttributes(updatedAttributes); }; const paginationBlock = getPaginationBlock(clientId); const paginationToggle = (newValue) => { setAttributes({ paginationEnable: !newValue }); if (!newValue && paginationBlock) { const { block, select } = paginationBlock; select(block?.clientId); } }; return ( <> , value: "left" }, { label: , value: "center" }, { label: , value: "right" }, ]} /> {/* */} Unlock exclusive layouts and advanced display controls. Upgrade to Pro! ); }; const DividerGeneralTab = ({ attributes, setAttributes }) => { const { showHideDivider, dividerBorderStyle, dividerAlignment } = attributes; const setBorderStyle = (newValue) => { setAttributes({ dividerBorderStyle: newValue }); }; return ( <> {showHideDivider && ( <> setBorderStyle(newValue)} items={[ { label: "None", value: "none" }, { label: "Solid", value: "solid" }, { label: "Dotted", value: "dotted" }, { label: "Dashed", value: "dashed" }, { label: "Double", value: "double" }, { label: "Groove", value: "groove" }, { label: "Inset", value: "inset" }, { label: "Outset", value: "outset" }, { label: "Ridge", value: "ridge" }, ]} flexStyle={true} /> , value: "left" }, { label: , value: "center" }, { label: , value: "right" }, ]} /> )} ); }; const DividerStyleTab = ({ attributes, setAttributes }) => { const { dividerBg, dividerWidth, dividerHeight } = attributes; return ( <> , value: "bgColor", tooltip: "Solid", }, { label: , value: "gradient", tooltip: "Gradient", }, ]} /> ); }; export const Divider = ({ attributes, setAttributes }) => { return ( ); };