/* eslint-disable @next/next/no-img-element */
"use client";
import React from "react";
import Link from "next/link";
import { Banner } from "../lib/types";
interface BannerPlacementProps {
banners: Banner[];
position: "home_middle" | "home_bottom" | "shop_top" | "category_top" | "product_sidebar";
className?: string;
}
export default function BannerPlacement({
banners,
position,
className = "",
}: BannerPlacementProps) {
const filteredBanners = (banners || []).filter(
(b) => b.position === position && b.isActive !== false && b.imageUrl
);
if (!filteredBanners || filteredBanners.length === 0) {
return null;
}
// Multi-column layout for home_middle if 2 or more banners exist
if (position === "home_middle") {
return (
{banner.subtitle}
{banner.subtitle}
{(banner.title || banner.subtitle) && (
{banner.title}
)}
{banner.subtitle && (
{(banner.title || banner.subtitle) && (
{banner.title}
)}
{banner.subtitle && (