// ----------------------------------------------------------------------------- // House-Ka — Homes-for-sale aggregator (Canada outside Québec, Ontario first) // Author: Simon-Pierre Boucher — contact@spboucher.ai // components/ListingCard.tsx : property card (results grid) // ----------------------------------------------------------------------------- import { Link } from "react-router-dom"; import { Listing, fmtArea, fmtPrice, sourceName } from "../api"; import { Ico } from "./Icons"; import PropertyImg from "./PropertyImg"; export default function ListingCard({ l }: { l: Listing }) { // light thumbnail when the connector provides one (mobile/cellular), // otherwise the full-size cover photo const img = (typeof l.details?.cover_thumb === "string" && l.details.cover_thumb) || (l.images && l.images.length > 0 ? l.images[0] : null); const rent = l.details?.transaction === "location"; const meta: { ico: string; txt: string }[] = []; if (l.bedrooms != null) meta.push({ ico: "bed", txt: `${l.bedrooms} bed` }); if (l.bathrooms != null) meta.push({ ico: "bath", txt: `${l.bathrooms} bath` }); const area = fmtArea(l.area_sqft); if (area) meta.push({ ico: "area", txt: area }); return (
{l.property_type && {l.property_type}} {l.images.length > 1 && ( {l.images.length} )}
{fmtPrice(l.price, l.price_label)} {rent && /month}
{l.address || l.title}
{l.sector && {l.sector}} {l.sector && l.city && } {l.city && {l.city}}
{meta.length > 0 && (
{meta.map((m) => ( {m.txt} ))}
)}
{sourceName(l.source)} {l.mls && MLS® {l.mls}}
); }