Introduction
The Natours project features a comprehensive set of reusable UI components built with modern CSS techniques including Sass, BEM methodology, and advanced CSS animations. All components follow a consistent design system with carefully crafted interactions and visual effects.Component Architecture
Components are organized in thesass/components/ directory following a modular structure:
BEM Naming Convention
All components follow the BEM (Block Element Modifier) methodology for CSS class naming:- Block
- Element
- Modifier
The standalone component name:
Available Components
Buttons
Primary, secondary, and text link buttons with hover animations and variants
Cards
3D flip cards with front/back sides, perfect for showcasing tours and products
Forms
Text inputs with floating labels and custom radio buttons with validation states
Navigation
Full-screen hamburger menu with animated icon and expanding background
Popup
Modal overlay with smooth animations and multi-column text layout
Composition
Overlapping image arrangement with hover effects and artistic positioning
Feature Box
Feature display boxes with gradient icons and lift-on-hover animations
Story
Customer testimonial cards with circular images and reveal-on-hover captions
Background Video
Full-screen background video with low opacity for ambient effect
Design System
Color Palette
The component library uses a carefully selected color scheme defined insass/abstracts/_variables.scss:
Typography
Common Mixins
Components leverage reusable Sass mixins defined insass/abstracts/_mixins.scss:
Absolute Center
Perfectly centers an element both horizontally and vertically:Clearfix
Clears floats within a container:Component Features
All components are built with progressive enhancement in mind, featuring:
- Smooth CSS transitions and animations
- Hover and focus states for better UX
- Accessibility considerations (proper focus states, semantic HTML)
- Responsive design patterns
Key Techniques Used
3D Transforms
3D Transforms
Used extensively in the card component for flip animations using
perspective, backface-visibility, and rotateY transforms.CSS Clip Path
CSS Clip Path
Creates unique shapes for card images and creates the signature polygonal clipping effect on pictures.
Gradient Overlays
Gradient Overlays
All components use
linear-gradient and radial-gradient for rich visual effects, especially on backgrounds and text.Custom Properties
Custom Properties
Extensive use of Sass variables enables easy theming and consistent styling across all components.
Pseudo-elements
Pseudo-elements
::before and ::after pseudo-elements create visual effects without additional markup, like button hover effects and radio button indicators.Getting Started
Copy the HTML Structure
Each component page includes the complete HTML markup with proper BEM class names.
Browser Support
Make sure to test components in your target browsers and include appropriate prefixes using a tool like Autoprefixer.Next Steps
Explore individual component pages for detailed documentation, code examples, and implementation guidelines:- Buttons - Learn about all button variants
- Cards - Master the 3D flip card effect
- Forms - Implement beautiful form controls
- Navigation - Build the hamburger menu
- Popup - Add modal overlays
- Composition - Create overlapping image layouts
- Feature Box - Display features with gradient icons
- Story - Build testimonial cards with circular images
- Background Video - Add ambient video backgrounds