Overview
Hero components are designed to create impactful first impressions on landing pages and promotional pages. They combine imagery, headlines, pricing, and call-to-action elements.HeroOfertas
The primary hero component for promotional offer pages. It displays a promotional offer with an image, title, subtitle, pricing, and feature list.Props
The unique identifier for the promotion. Must match an entry in
@/data/promociones.json.Data Structure
The component fetches data frompromociones.json based on the idPromo prop. The expected data structure:
Usage
Component Structure
The component is organized into two main sections:- Left Section (60% width): Product/service image
- Right Section (40% width): Promotional content
- Main title (h1)
- Subtitle (h2)
- Price display
- Additional details text
- Feature list
Layout
Responsive Behavior
- Desktop (>900px)
- Mobile (≤900px)
- Side-by-side layout (image left, content right)
- Image: 60% width
- Content: 40% width
- Font sizes: h1=2.5rem, h2=1.5rem
Styling Features
CSS Variables
CSS Variables
The component uses custom CSS variables for theming:
--bg-ofertas: Background color for the hero section--color-ofertas: Text color for titles and content--precio-destacado: Color for the highlighted price
Typography
Typography
- H1: Uppercase transformation, 2.5rem (1.8rem mobile)
- H2: Light weight (300), 1.5rem (1.3rem mobile)
- Price: 2.5rem (2rem mobile), colored with
--precio-destacado - List items: 1rem, line-height: 1
Spacing
Spacing
- Section padding: 1rem
- Content gap: 2rem
- Max width: 1200px (centered)
- List margins: 2rem horizontal on desktop
Customization Examples
Welcome Component
TheWelcome.astro component is a default Astro starter hero component, primarily used for development and testing.
Features
- Astro logo and branding
- Links to documentation and Discord
- Background effects
- “What’s New” callout box
The Welcome component is typically replaced with HeroOfertas or custom hero components in production builds.
Best Practices
Image Optimization
Use WebP format for hero images and set appropriate width/height attributes for better performance.
Content Length
Keep feature lists to 4-6 items for optimal readability and visual balance.
Price Display
Use the
destacado field for additional pricing context like “per month” or “limited time”.Mobile Testing
Always test hero components on mobile devices to ensure text readability and proper image scaling.
Accessibility
Image Alt Text
Image Alt Text
The component uses an empty alt attribute (
alt="") for decorative images. For meaningful images, update the template:Heading Hierarchy
Heading Hierarchy
- Uses semantic HTML with proper h1 and h2 tags
- Maintains logical heading structure for screen readers
- Consider page context when using h1 tags
Related Components
- UrgencyBanner - Add countdown timers to create urgency
- BotonPrecios - Call-to-action buttons for pricing
- PromoMain - Alternative promotional layout
Source Code Reference
Component location:src/components/Promociones/HeroOfertas.astro:1-148
Data source: src/data/promociones.json