/** * Placeholder component for slide block * Shows when no background is set */ import React from "react"; // @ts-ignore import { isEmpty } from "lodash"; // @ts-ignore import { __ } from "@wordpress/i18n"; import { MediaPlaceholder, useSetting } from "@wordpress/block-editor"; import { ColorPalette } from "@wordpress/components"; import classnames from "classnames"; import { getBorderCSS, getSingleSideBorderValue, } from "../../../components/shared/utils/styling-helpers"; import type { MediaObject } from "../../../types"; interface SlidePlaceholderProps { clientId: string; contentPosition: string; backgroundColor: string; border: Record; slideBorderRadius: Record; minHeight: number; onUpdate: (attrs: Record) => void; } export const SlidePlaceholder: React.FC = ({ clientId, contentPosition, backgroundColor, border, slideBorderRadius, minHeight, onUpdate, }) => { const colorSettings = useSetting("color.palette") || []; // Apply border styles const borderInFourDimensions = !isEmpty(border) ? getBorderCSS(border) : null; return (
onUpdate({ backgroundImage: { id: media.id, url: media.url, alt: media.alt || "", }, focalPoint: { x: 0.5, y: 0.5 }, }) } accept="image/*" allowedTypes={["image"]} >
onUpdate({ backgroundColor: color || "", }) } asButtons clearable={false} disableCustomColors />
); };