import { __ } from "@wordpress/i18n";
import { RightSymbolIcon } from "../../icons";
import "./editor.scss";
const Layout = ({ layout, handleActive, activeLayout, displayActive, preset = true }) => {
const { Icon, value, label, onlyPro } = layout;
const navigateToPricing = () => {
window.open("https://easyaccordion.io/pricing/", "_blank", "noopener,noreferrer");
};
return (
!onlyPro && handleActive(value)}
onClick={() => {
if (onlyPro) {
navigateToPricing();
} else {
handleActive(value);
}
}}
className={`sp-easy-accordion-layout-card ${value === activeLayout ? "active" : "inactive"} ${onlyPro ? "sp-eab-only-pro-card" : ""}`}
>
{value === activeLayout && displayActive && (
)}
{/* {Icon &&
} */}
{label && !preset &&
{label}
}
);
};
const Layouts = ({
attributes,
setAttributes,
attributesKey,
displayActive = false,
label = "",
grid = 2,
items,
preset = false,
blockName = "",
demoLink = "https://easyaccordion.io/pricing/",
onClick = false,
}) => {
const handleActive = (value) => {
if (value === attributes) {
return;
}
setAttributes({ [attributesKey]: value });
};
return (
{label &&
{label}}
{items?.map((layout, index) => (
))}
{preset && blockName === "vertical-accordion" && (
)}
);
};
export default Layouts;