Overview
The Fragancias component displays a list of available candle fragrances in an elegant, centered layout. It features fade-up animations triggered by intersection observers and includes a message encouraging customers to request custom fragrances not listed.Component code
Props
This component does not accept any props. All fragrances are hardcoded within the component.Usage example
Available fragrances
The component currently lists five fragrances:- Vainilla (Vanilla)
- Pino (Pine)
- Sándalo (Sandalwood)
- Canela (Cinnamon)
- Lavanda (Lavender)
The component includes a message informing customers that custom fragrances can be sourced upon request: “Si deseas alguna fragancia que no se encuentre aquí nosotros la conseguimos”
Styling details
Container layout
Container layout
The component uses a centered flexbox layout:
- Outer container: Full width with flex column, centered horizontally and vertically
- Inner container: 80% width on mobile, 50% width on large screens (lg breakpoint)
- Top and bottom margin: 5rem (my-20) for vertical spacing
Typography
Typography
- Heading: 3xl text size (1.875rem), centered, 2.5rem bottom margin
- Fragrance items: 2xl text size (1.5rem), orange-900 color, centered, italic style
- Bottom message: lg text size (1.125rem), centered, 2.5rem top margin
- Item spacing: 1.25rem bottom margin (mb-5) between each fragrance
Animation
Animation
The entire component animates into view using intersection observers:
- Animation type: Fade-up (slides up while fading in)
- Duration: 1000ms (1 second)
- Timing: Ease-in function
- Frequency: Once only (doesn’t repeat when scrolling back)
- Trigger: When component enters viewport
Color scheme
Color scheme
The component uses warm, earthy tones:
- Fragrance text:
text-orange-900(#7c2d12) - Heading and message: Default black text
- Background: Inherits from parent (typically white)
Responsive behavior
Responsive behavior
The component adapts to screen size:
- Mobile: Container uses 80% of viewport width
- Large screens (lg): Container reduces to 50% of viewport width for better readability
- All text remains centered across all breakpoints
Content structure
“Fragancias disponibles” - Introduces the fragrance list
Displays available fragrances in a vertical list with consistent spacing and styling
Informs customers that unlisted fragrances can be sourced on request
Best practices
The component’s animation is set to
animate-once, meaning it only plays when first entering the viewport. This prevents distracting repeated animations as users scroll up and down the page.Dependencies
- Tailwind CSS: Flexbox utilities, responsive design, typography, and spacing
- Intersection Observer API: Powers the
intersect:animation trigger - Tailwind Animate Plugin: Provides the
animate-fade-upanimation utility
