File: src/blocks/banner/Banner02.astro
Fixed floating pill banner (centered, high z-index) with radius, shadow, and top offset. Optional dismiss and CTA.
Include BannerDismissScript once when dismissible.
Config (banner.ts → banner02)
banner02: {
enabled: false,
id: "site-banner-02",
message: "New case studies just dropped — explore recent work.",
bold: ["case studies"],
textVariant: "sm",
width: "wide",
background: "elevated",
dismissible: true,
dismissDays: 14,
cta: {
label: "Browse projects",
href: "/work/",
variant: "outline",
size: "sm",
},
borderRadius: "lg", // "none" | "md" | "lg" | "full"
shadow: "subtle", // "none" | "subtle" | "medium"
offsetTop: "1rem",
},
Add to a page
---
import Banner02 from "@/blocks/banner/Banner02.astro";
import BannerDismissScript from "@/blocks/banner/BannerDismissScript.astro";
---
<Banner02
enabled
message="Limited offer — 20% off this week."
borderRadius="lg"
shadow="medium"
offsetTop="5.5rem"
/>
<BannerDismissScript />
Props
| Prop | Config key | Notes |
|---|---|---|
enabled |
banner02.enabled |
|
id |
banner02.id |
Dismiss storage key |
message / bold |
banner02.* |
Same as Banner01 |
textVariant / width / background |
banner02.* |
|
textClass |
— | Override text color |
dismissible / dismissDays |
banner02.* |
|
cta |
banner02.cta |
|
borderRadius |
banner02.borderRadius |
"none" | "md" | "lg" | "full" |
shadow |
banner02.shadow |
"none" | "subtle" | "medium" |
offsetTop |
banner02.offsetTop |
CSS top value |
Also include: BannerDismissScript.astro when dismissible.