Overview
AlquilerButton (exported as RentalButton in source) is a button component that handles movie rental transactions. It displays the rental price, simulates a processing delay, and provides feedback to the user.
Import
Props
Movie object containing rental informationRequired properties:
title(string): Movie title (used in confirmation message)alquilerPrecio(number): Rental price in currency units
Callback function invoked when the rental process completesSignature:
(pelicula: object) => voidParameters:pelicula(object): The movie object that was rented
Component Signature
Internal State
Tracks whether a rental transaction is in progress. When
true, the button displays “Procesando…” and is disabled.Features
Simulated Transaction
Simulates a 500ms rental processing delay:Loading State
Button text and disabled state change during processing:User Feedback
Displays an alert with rental confirmation:Usage Example
- In Detail Page
- Basic Usage
Rendered Structure
Button States
| State | Text | Disabled | Behavior |
|---|---|---|---|
| Idle | Alquilar por S/ {price} | false | Clickable, starts rental |
| Processing | Procesando... | true | Not clickable, rental in progress |
Rental Flow
CSS Classes
.alquiler-button- Main button element
Currency Format
The component uses Peruvian Soles (S/) in the button text and alert message:Rental Duration
The alert message indicates a 48-hour rental period (hardcoded in the alert).Source Location
src/components/AlquilerButton.jsx:3