import { MediaPlaceholder } from "@wordpress/block-editor";

export default function Cover({ coverUrl, coverAlt, onSelect }) {
	return (
		<div className="narrative-card__cover">
			{coverUrl && <img src={coverUrl} alt={coverAlt} />}
			{!coverUrl && (
				<MediaPlaceholder
					accept="image/*"
					allowedTypes={["image"]}
					onSelect={onSelect}
					multiple={false}
					handleUpload={true}
				/>
			)}
		</div>
	);
}
