import { memo } from "@wordpress/element";
import { RightSymbolIcon } from "../../icons/icons";
import "./editor.scss";
import ProBtn from "../proBtn/proBtn";
const Layout = ({ layout, handleActive, activeLayout, displayActive, proBtnClass = ""}) => {
const { icon, value, label, type, demoLink } = layout;
return (
handleActive(value) : null }
className={`sp-smart-post-layout-card ${type === "pro" ? "sp-smart-pro-layout" : ""} ${value === activeLayout ? "active" : "inactive"}`}
>
{value === activeLayout && displayActive && (
)}
{type !== "pro" &&
{icon}
}
{type === "pro" &&
{icon}
}
{label &&
{label}
}
);
};
const Layouts = ({
attributes,
setAttributes,
attributesKey,
displayActive = false,
label = "",
proBtnClass = "",
showDemoTitle = false,
grid = 2,
items,
onChange = false,
}) => {
const handleActive = (value) => {
if (value === attributes) {
return;
}
if (onChange) {
onChange(value);
}
setAttributes({ [attributesKey]: value });
};
return (
{label &&
{label}
}
{items?.map((layout, index) => (
))}
);
};
export default memo(Layouts);