Overview
The Rodando Driver app provides two layout components that establish the application’s structure and navigation patterns. These components wrap page content and provide consistent UI elements across different sections of the app.DefaultLayoutComponent
The primary layout component for most pages, featuring a floating header with action buttons and a bottom navigation bar.Component Metadata
The component selector used in templates
Standalone component that can be imported directly without a module
Required imports:
IonHeader, IonRouterOutlet, IonFooter, IonToolbar, IonButton, IonIcon, FloatingButtonComponent, RouterModule, IonContentStructure
The layout consists of three main sections:- Floating Header: Fixed position header with floating action buttons
- Content Area: Router outlet for page content
- Bottom Navigation: Fixed footer with tab navigation
Header
The header contains two floating buttons:- Icon:
menu-outline - Position:
start(left side) - Opens the main navigation menu
- Icon:
notifications-outline - Position:
end(right side) - Opens notifications panel
Bottom Navigation
The footer provides tab-based navigation with four main sections:- Icon:
home-outline - Route:
/home - Description: Dashboard and main overview
- Active state: Exact route match required
- Icon:
location-outline - Route:
/map - Description: Map view for navigation and trip tracking
- Icon:
time-outline - Route:
/trips/active - Description: View and manage active trips
- Icon:
person-outline - Route:
/earnings - Description: Driver profile and earnings information
Usage
The layout is typically used in route configurations:Template Structure
Styling
The component uses custom CSS classes for styling:Styles the header with floating button positioning
Container for the floating action buttons
Styles the bottom navigation bar
Container for tab navigation icons
Applied to active tab buttons via
routerLinkActiveCustom Styling Example
MapLayoutComponent
A minimal layout component for map-focused pages with full-screen map display.Component Metadata
The component selector used in templates
This component requires a module declaration
Structure
The component provides a basic container for map-centric views:- Full-screen map container
- Overlay controls
- Custom navigation elements
- Status indicators
Usage
Use this layout for dedicated map views:Typical Enhancement Pattern
For production use, you might enhance the map layout like this:Layout Selection Guide
Choose the appropriate layout based on your page requirements:Use DefaultLayoutComponent when:
- Page needs standard navigation (header + bottom tabs)
- Content is primarily text, lists, or forms
- User needs quick access to all app sections
- Page is part of the main app flow
Use MapLayoutComponent when:
- Page is map-centric or map-only
- Full-screen real estate is needed for the map
- Navigation should be minimal or custom
- Page focuses on location-based features
Layout Integration with Child Components
Accessing Layout from Child Routes
Child components can interact with their parent layout:Communication Between Layout and Children
Use services for state management across layout and child components:Best Practices
Performance
- Use lazy loading: Load child routes with
loadComponent()for better performance - Avoid nested layouts: Don’t nest DefaultLayoutComponent instances
- Cache navigation state: Use Angular’s router state management
Accessibility
- Navigation labels: Ensure all navigation buttons have proper aria-labels
- Active state indication: Use both visual and ARIA attributes for active tabs
- Keyboard navigation: Test tab navigation with keyboard
Responsive Design
Source Code References
-
DefaultLayoutComponent:
src/app/shared/layouts/default-layout/- Component:
default-layout.component.ts - Template:
default-layout.component.html - Styles:
default-layout.component.scss - Tests:
default-layout.component.spec.ts
- Component:
-
MapLayoutComponent:
src/app/shared/layouts/map-layout/- Component:
map-layout.component.ts - Template:
map-layout.component.html - Styles:
map-layout.component.scss - Tests:
map-layout.component.spec.ts
- Component: