Floating Action Elements
Relevant source files
The following files were used as context for generating this wiki page:
Floating Action Elements in the AVP Supercars platform comprise persistent and semi-persistent UI components designed to provide immediate access to communication channels and navigation controls. These elements remain accessible regardless of the user's scroll position, ensuring that the primary "Request" call-to-action is always available.
The system primarily utilizes React's client-side capabilities and the Framer Motion library to handle positioning, visibility transitions, and user interactions. These elements are integrated at the root level of the application to ensure consistent behavior across all routes.
Sources: app/layout.tsx:88, components/WhatsAppFloat.tsx:3-20, components/Navbar.tsx:40-150
Floating Communication Overlay
The primary floating element is the WhatsAppFloat component. It serves as a high-priority communication shortcut positioned in the viewport's corner, specifically designed for "fast reply" inquiries.
WhatsApp Float Implementation
The component is implemented as a fixed-position anchor tag. It utilizes a pre-configured phone number and an encoded URI string to initiate a conversation via the WhatsApp API (wa.me).
| Property | Value/Effect |
|---|---|
| Positioning | fixed bottom-5 right-5 z-50 |
| Styling | Backdrop blur (70% opacity), rounded-2xl, white border (15% opacity) |
| Action | Opens https://wa.me/[NUMBER]?text=[ENCODED_TEXT] in a new tab |
| Interaction | Hover transition changing background to white/10 |
Sources: components/WhatsAppFloat.tsx:4-18
The diagram above illustrates the interaction flow from the floating UI element to the external communication service.
Sources: components/WhatsAppFloat.tsx:5-15
Persistent Navigation and Header
The Navbar component functions as a floating action element when the user scrolls. It transitions from a transparent state to a blurred, fixed header to maintain navigation accessibility.
Sticky Header Logic
The component monitors the window.scrollY position using a React useEffect hook. When the scroll offset exceeds 12 pixels, the state scrolled is set to true, triggering a CSS class transition.
- Initial State:
bg-transparent - Scrolled State:
bg-black/70 backdrop-blur-xl border-b border-white/10
Sources: components/Navbar.tsx:31-48
This sequence diagram shows how the navigation bar's visual properties react dynamically to user scrolling.
Sources: components/Navbar.tsx:30-40
Floating Contextual Controls
On specific pages, such as the Fleet listing, additional floating elements are introduced to manage content density.
Sticky Fleet Filters
The FleetFilters component utilizes the sticky positioning attribute (sticky top-20 z-40). This ensures that search and category selection tools remain at the top of the viewport while the user browses the vehicle list. It features a high z-index and backdrop blur to maintain readability against the scrolling car cards.
Sources: components/FleetFilters.tsx:38-40
Global Integration
Floating elements are instantiated within the RootLayout to provide a unified user experience. The WhatsAppFloat and Navbar are placed outside the main {children} block to ensure they remain in the top-level stacking context.
// app/layout.tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body className="bg-black text-white">
<Navbar />
{children}
<Footer />
<WhatsAppFloat />
</body>
</html>
);
}
Sources: app/layout.tsx:13-89
Conclusion
Floating Action Elements in this architecture are critical for converting user interest into direct inquiries. By combining the WhatsAppFloat for mobile-first communication, the sticky Navbar for global navigation, and the sticky FleetFilters for content discovery, the system maintains high usability and accessibility standards across the entire supercar catalog.