// Listings.jsx — reusable filter + grid; used by Home preview + Properties page.
const { useState: useStateL, useMemo: useMemoL } = React;
function PropertyCard({ p, onClick, idx }) {
const [hover, setHover] = useStateL(false);
const [saved, setSaved] = useStateL(false);
return (
setHover(true)} onMouseLeave={() => setHover(false)}
style={{
background: 'var(--color-cloud-soft)', borderRadius: 20,
overflow: 'hidden',
boxShadow: hover ? 'var(--shadow-elevated)' : 'var(--shadow-soft)',
transform: hover ? 'translateY(-3px)' : 'none',
transition: 'all 360ms var(--ease-luxury)',
cursor: 'pointer', fontFamily: 'var(--font-body)',
}}>
{/* Editorial index number */}
№ {String(idx).padStart(2, '0')}
{p.featured && (
Featured
)}
{p.tags.slice(0, 2).map(t => (
{t}
))}
{p.neighborhood} · Seattle
{p.title}
{p.address}
${p.price.toLocaleString()}
/mo
{p.beds === 0 ? 'Studio' : p.beds + ' bd'} · {p.baths} ba · {p.sqft.toLocaleString()} sf
{p.available}
);
}
function Listings({
variant = 'grid', // 'grid' (3-up) | 'fullbleed' (4-up)
showFilters = true,
showSort = true,
limit,
onSelect,
}) {
const { PROPERTIES, PROPERTY_TYPES, SEATTLE_NEIGHBORHOODS } = window.SantirmaData;
const [activeType, setActiveType] = useStateL('All');
const [activeHood, setActiveHood] = useStateL('All Seattle');
const [sort, setSort] = useStateL('featured');
const [maxPrice, setMaxPrice] = useStateL(6000);
const filtered = useMemoL(() => {
let r = PROPERTIES.slice();
if (activeType !== 'All') r = r.filter(p => p.type === activeType || (activeType === 'Furnished' && p.furnished));
if (activeHood !== 'All Seattle') r = r.filter(p => p.neighborhood === activeHood);
r = r.filter(p => p.price <= maxPrice);
if (sort === 'price-asc') r.sort((a,b) => a.price - b.price);
else if (sort === 'price-desc') r.sort((a,b) => b.price - a.price);
else if (sort === 'newest') r.sort((a,b) => a.title.localeCompare(b.title));
else r.sort((a,b) => (b.featured?1:0) - (a.featured?1:0));
return limit ? r.slice(0, limit) : r;
}, [activeType, activeHood, sort, maxPrice, limit, PROPERTIES]);
const cols = variant === 'fullbleed' ? 'repeat(4, 1fr)' : 'repeat(3, 1fr)';
return (
{showFilters && (
{PROPERTY_TYPES.map(t => (
))}
setMaxPrice(+e.target.value)}
style={{ flex: 1, accentColor: 'var(--color-prestige-gold)' }} />
{showSort && (
)}
)}
{filtered.map((p, i) => (
onSelect(p)} />
))}
{filtered.length === 0 && (
Nothing on the books matching that.
Try widening the price or removing a filter — or call us at
206.555.0148, we keep an off-market list.
)}
);
}
window.SantirmaListings = Listings;
window.SantirmaPropertyCard = PropertyCard;