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

export default function save({ attributes }) {
	let { partnerLogoUrl, partnerLogoAlt, partnerWebsite } = attributes;

	return (
		<div
			{...useBlockProps.save({
				className: `homegrade-blocks-partner-logo`,
			})}
		>
			{partnerLogoUrl && partnerWebsite && (
				<a href={partnerWebsite} target="_blank" rel="noopener">
					<img
						className="homegrade-blocks-partner-logo__logo"
						src={partnerLogoUrl}
						alt={partnerLogoAlt}
					/>
				</a>
			)}

			{partnerLogoUrl && !partnerWebsite && (
				<>
					<img
						className="homegrade-blocks-partner-logo__logo"
						src={partnerLogoUrl}
						alt={partnerLogoAlt}
					/>
				</>
			)}
		</div>
	);
}
