Overview
ThePropertyCard component displays property information in a card format, featuring an image, property details, pricing, amenities, and action buttons. It includes favorites functionality, status overlays, and WhatsApp integration.
Import
Props
The property object containing all property information. See the Property Type section below for details.
Property Type
TheProperty interface includes the following key fields:
Unique identifier for the property
URL-friendly slug for better SEO links
Property title/name
Current price of the property
Original price (shown with strikethrough if different from current price)
Currency code (e.g., “USD”, “ARS”)
Type of property (e.g., “casa”, “departamento”, “terreno”, “local”)
Listing operation type (e.g., “venta”, “alquiler”, “venta-y-alquiler”)
Number of bedrooms
Number of bathrooms
Number of garage spaces
Array of image URLs
Property status (e.g., “activo”, “pendiente”, “vendido”, “alquilado”, “reservado”)
Contact phone number for WhatsApp integration
Address information including street, city, state, etc.
Alternative location object with similar fields to address
Features
Status Overlays
When a property has certain statuses, an overlay is displayed on the image:- Pendiente (Pending)
- Vendido (Sold)
- Alquilado (Rented)
- Reservado (Reserved)
Favorites System
The card includes a heart icon button that allows users to:- Add properties to favorites (requires authentication)
- Remove properties from favorites
- Shows login modal for unauthenticated users
Price Display
Pricing is displayed with the following logic:- If
originalPriceexists and is greater thanprice, both are shown (with original price struck through) - Otherwise, only the current price is displayed
- If no price is available, shows “Consultar precio”
Property Statistics
Displays relevant property information with icons:- Ambientes (Rooms) - Purple icon
- Dormitorios (Bedrooms) - Red icon
- Baños (Bathrooms) - Blue icon
- Cocheras (Garage spaces) - Gray icon
- Superficie cubierta (Covered surface) - Green icon
- Terreno (Lot size) - Orange icon
Action Buttons
- Ver propiedad - View property details (navigates to property page)
- Consultar - Opens WhatsApp with pre-filled message (only shown if
contactPhoneexists)
Usage Example
Styling
The component uses Tailwind CSS classes and includes:- Hover effects on the card (shadow enhancement)
- Image zoom effect on hover
- Responsive design (adjusts height based on price display)
- Smooth transitions for all interactive elements
Card Heights
- With discount:
min-h-[550px](when originalPrice > price) - Standard:
min-h-[500px]
Dependencies
@tanstack/react-router- For navigation (Link component)lucide-react- For icons (Bed, Bath, Heart, LayoutGrid, Ruler, Car, MessageCircle)AuthContext- For favorites functionality
Accessibility
- All interactive elements have
tabIndex={0}for keyboard navigation - Buttons include
aria-labelattributes - Images include alt text
- Semantic HTML structure
Source Code
View the full implementation atsrc/components/PropertyCard.tsx:1