Overview
The BotonFlotante component is a fixed-position floating action button (FAB) that provides quick navigation back to the previous page. It uses Material-UI’sFab component with custom styling and hover animations.
Props
This component does not accept any props. It automatically uses React Router’s navigation.Usage
The component is used on the project detail page to allow users to quickly return to the previous page:src/pages/ProyectoDetalle.jsx
Component Structure
src/components/BotonFlotante.jsx
Key Features
Fixed Positioning
The button remains visible in the bottom-right corner regardless of scroll position:- Position: Fixed at bottom: 30px, right: 30px
- Z-index: 1000 ensures it appears above other content
- Size: 60x60px circular button
Navigation Behavior
Uses React Router’snavigate(-1) to return to the previous page:
Visual Styling
| Property | Default | Hover |
|---|---|---|
| Background | #15F5BA (cyan) | #836FFF (purple) |
| Text color | #211951 (dark) | #F0F3FF (light) |
| Box shadow | 15px glow | 25px glow |
| Transform | none | scale(1.1) + rotate(-10deg) |
Animations
The button features smooth transitions:- Scale: Grows 10% on hover
- Rotation: Rotates -10 degrees
- Color shift: Cyan to purple gradient
- Glow effect: Shadow intensity increases
- Duration: 0.3s ease transition
Accessibility
Material-UI Components
- Fab - Floating Action Button from @mui/material
- ArrowBackIcon - Back arrow icon from @mui/icons-material
Dependencies
package.json
Customization
Change Position
Change Colors
Change Icon
Change Size
Best Practices
The rotate animation on hover adds personality and draws attention to the button’s interactivity.
Related Components
TrophyButton
Another interactive button with animations
FlipScienceCard
Interactive card with hover effects