SeasonalBanner component automatically displays banners for liturgical seasons and holidays using a liturgical calendar utility. It includes countdown timers, seasonal colors, and dynamic messaging.
Features
- Automatic Detection: Uses liturgical calendar to determine current season
- Countdown Timers: Shows days until major holidays
- Dynamic Colors: Season-appropriate background colors
- Seasonal Icons: Emojis for visual appeal
- Responsive Design: Mobile and desktop optimized
- Auto-refresh: Updates hourly to catch date changes
- Client-Side Rendering: Always shows current date/countdown
Installation
Usage
Fromsrc/layouts/Layout.astro:249:
Props
This component does not accept any props. All behavior is automatic based on the current date and liturgical calendar.Liturgical Calendar Integration
The component imports calendar utilities:Example Configurations
Advent (with countdown)
Christmas (no countdown)
Ordinary Time
Display Logic
With Countdown
"It's Advent, there are 10 days until Christmas!""It's Holy Week, there is 1 day until Easter!"
With Message
Mobile vs. Desktop
- Countdown:
"12 days until Christmas!" - Message: Truncated to 30 characters
- Full message with season name
Text Color Logic
Automatically determines readable text color:- Light backgrounds (white): Dark text (#1f2937)
- Dark backgrounds: White text (#ffffff)
- Light backgrounds get subtle border
Banner Rendering
Auto-Refresh
Banner updates automatically:- Catches midnight date changes
- Updates countdown numbers
- Low performance impact
- Always accurate for current day
Animation
Responsive Breakpoints
- Shorter message text
- Tighter line height
- Hidden desktop content
- Smaller padding
Accessibility
role="banner": Semantic landmarkaria-label: Describes seasonaria-hidden="true": Decorative icons- High contrast colors
- Readable font sizes
Example Seasons
Church Year Seasons
-
Advent (4 weeks before Christmas)
- Color: Dark blue
- Icon: 🕯️ (candle)
- Countdown to Christmas
-
Christmas (12 days)
- Color: Red or white
- Icon: 🎄 (tree)
- Message: “Merry Christmas”
-
Epiphany
- Color: Green or white
- Icon: ⭐ (star)
- Message varies
-
Lent (40 days before Easter)
- Color: Purple
- Icon: ✝️ (cross)
- Countdown to Easter
-
Holy Week
- Color: Deep purple/red
- Icon: ✝️
- Countdown to Easter
-
Easter (50 days)
- Color: White or gold
- Icon: 🌅 (sunrise)
- Message: “He is Risen!”
-
Pentecost
- Color: Red
- Icon: 🔥 (flame)
- Message varies
-
Ordinary Time
- Color: Green
- Icon: ✝️
- Default fallback
Customization
Add Custom Season
Modify the liturgical calendar utility:Change Colors
Disable Auto-Refresh
Custom Update Frequency
Testing
Test Specific Date
Test Countdown Logic
Performance
- Client-side rendering only
- Minimal DOM updates
- Cached calculations
- No external API calls
- Lightweight JavaScript
Related Components
- Layout: Where SeasonalBanner is included
- WeatherBanner: Emergency announcements
- AlertBanner: Important notices
Related Files
src/utils/liturgicalCalendar.ts: Season calculation logicsrc/layouts/Layout.astro: Where component is used