import type { ReactNode } from "react";
import Link from "next/link";
import { Placeholder } from "@/components/Placeholder";
import { parseAspectRatio } from "@/lib/static-images";
type SlotMediaProps = {
src: string;
alt?: string;
href?: string;
fallbackSrc?: string;
aspectRatio?: string;
className?: string;
imgClassName?: string;
fill?: boolean;
};
function wrap(href: string | undefined, children: ReactNode, className?: string) {
if (!href) return
{children}
;
if (href.startsWith("/") || href.startsWith("#")) {
return (
{children}
);
}
return (
{children}
);
}
export function SlotMedia({
src,
alt = "",
href,
fallbackSrc,
aspectRatio,
className = "",
imgClassName = "absolute inset-0 h-full w-full object-cover",
fill = false,
}: SlotMediaProps) {
const image = ;
if (fill) {
return wrap(href, image, `absolute inset-0 ${className}`.trim());
}
const ratio = parseAspectRatio(aspectRatio);
return wrap(
href,
{image}
,
className,
);
}