feat(ads): replace custom banner with Admitad leaderboard

This commit is contained in:
emil
2026-05-14 15:33:48 +03:00
parent 375455aac9
commit b22a68bf12
+18 -81
View File
@@ -1,86 +1,23 @@
---
interface Props {
size: "leaderboard" | "rectangle" | "tile";
size?: "leaderboard" | "rectangle" | "tile";
}
const { size } = Astro.props;
const ads = [
{
href: "https://kjuzv.com/g/q6gfnfvsq067a6d0fce8a804937a48/?erid=MvGzQC98w3Z1gMq1kx5ACoy5",
label: "Читай-город — книги со скидкой",
sublabel: "Более 3 млн книг с доставкой по всей России",
cta: "Купить",
ctaMobile: "Купить",
},
];
const ad = ads[Math.floor(Math.random() * ads.length)];
const specs = {
leaderboard: { class: "w-full h-[90px]", horizontal: true },
rectangle: { class: "w-full max-w-[300px] h-[250px]", horizontal: false },
tile: { class: "w-full h-[250px]", horizontal: false },
};
const { class: sizeClass, horizontal } = specs[size];
---
<aside aria-label="Реклама">
<a
href={ad.href}
target="_blank"
rel="noopener sponsored"
class={`${sizeClass} flex ${horizontal ? "flex-row items-center gap-4 px-6" : "flex-col items-center justify-center gap-3 px-4"} rounded-xl border border-zinc-800 bg-zinc-900/50 hover:border-accent/50 hover:bg-zinc-900 transition-colors duration-200 group`}
>
<svg
class="shrink-0 text-accent"
width={horizontal ? "32" : "40"}
height={horizontal ? "32" : "40"}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20" />
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z" />
</svg>
{
horizontal ? (
<>
<div class="flex-1 min-w-0">
<div class="text-xs font-medium text-zinc-500 uppercase tracking-widest mb-0.5">
Реклама
</div>
<div class="text-sm font-semibold text-zinc-100 group-hover:text-accent transition-colors leading-tight">
{ad.label}
</div>
<div class="text-xs text-zinc-500 mt-0.5">{ad.sublabel}</div>
</div>
<span class="shrink-0 text-xs font-semibold text-white bg-accent px-3 py-1.5 rounded-lg group-hover:bg-accent-hover transition-colors whitespace-nowrap">
{ad.cta}
</span>
</>
) : (
<>
<div class="text-center">
<div class="text-xs font-medium text-zinc-500 uppercase tracking-widest mb-2">
Реклама
</div>
<div class="text-base font-semibold text-zinc-100 group-hover:text-accent transition-colors leading-snug">
{ad.label}
</div>
<div class="text-xs text-zinc-500 mt-1">{ad.sublabel}</div>
</div>
<span class="text-xs font-semibold text-white bg-accent px-4 py-2 rounded-lg group-hover:bg-accent-hover transition-colors">
{ad.ctaMobile}
</span>
</>
)
}
</a>
</aside>
<!-- admitad.banner: om86773ouc67a6d0fce8a804937a48 Читай-город -->
<a
target="_blank"
rel="nofollow noopener sponsored"
href="https://kjuzv.com/g/om86773ouc67a6d0fce8a804937a48/?i=4&erid=2bL9aMPo2e49hMef4pgVKTDNgo"
>
<img
width="468"
height="60"
border="0"
src="https://aflink.ru/b/om86773ouc67a6d0fce8a804937a48/"
alt="Читай-город"
class="w-full h-auto max-w-[468px] mx-auto rounded-lg"
loading="lazy"
/>
</a>
<!-- /admitad.banner -->