Spaces:
Running
Running
File size: 5,537 Bytes
43601eb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | // Property data
const properties = [
{
id: 1,
title: "Luxury Riverside Apartment",
type: "apartment",
price: "$1,250,000",
bedrooms: 3,
bathrooms: 2,
area: "1,850 sq ft",
location: "Downtown",
image: "http://static.photos/real-estate/640x360/101"
},
{
id: 2,
title: "Modern Loft with City Views",
type: "apartment",
price: "$895,000",
bedrooms: 2,
bathrooms: 2,
area: "1,350 sq ft",
location: "Midtown",
image: "http://static.photos/real-estate/640x360/102"
},
{
id: 3,
title: "Exclusive Skyline Penthouse",
type: "penthouse",
price: "$3,500,000",
bedrooms: 4,
bathrooms: 3.5,
area: "3,200 sq ft",
location: "Uptown",
image: "http://static.photos/real-estate/640x360/103"
},
{
id: 4,
title: "Charming Brownstone House",
type: "house",
price: "$2,100,000",
bedrooms: 5,
bathrooms: 3,
area: "2,800 sq ft",
location: "Suburb",
image: "http://static.photos/real-estate/640x360/104"
},
{
id: 5,
title: "Top-Floor Penthouse Suite",
type: "penthouse",
price: "$4,200,000",
bedrooms: 5,
bathrooms: 4,
area: "3,700 sq ft",
location: "Downtown",
image: "http://static.photos/real-estate/640x360/105"
},
{
id: 6,
title: "Contemporary Studio Apartment",
type: "apartment",
price: "$650,000",
bedrooms: 1,
bathrooms: 1,
area: "800 sq ft",
location: "Midtown",
image: "http://static.photos/real-estate/640x360/106"
}
];
// Load properties on properties.html
if (window.location.pathname.includes('properties.html')) {
document.addEventListener('DOMContentLoaded', function() {
const container = document.querySelector('.property-container');
properties.forEach(property => {
const propertyCard = document.createElement('div');
propertyCard.className = `property-card bg-white rounded-lg shadow-lg overflow-hidden hover:shadow-xl transition-shadow duration-300`;
propertyCard.dataset.type = property.type;
propertyCard.innerHTML = `
<img src="${property.image}" alt="${property.title}" class="w-full h-48 object-cover">
<div class="p-6">
<div class="flex justify-between items-start mb-1">
<h3 class="text-xl font-semibold text-gray-800">${property.title}</h3>
<span class="bg-mint-100 text-mint-800 text-xs font-medium px-2.5 py-0.5 rounded">${property.type}</span>
</div>
<p class="text-gray-600 mb-3">${property.location} • ${property.bedrooms} beds • ${property.bathrooms} baths • ${property.area}</p>
<p class="text-2xl font-bold text-gray-800 mb-3">${property.price}</p>
<a href="property-detail.html?id=${property.id}" class="text-mint-600 hover:text-mint-800 font-medium inline-flex items-center">
View Details <i data-feather="arrow-right" class="ml-1 w-4 h-4"></i>
</a>
</div>
`;
container.appendChild(propertyCard);
});
// Filter functionality
const filterButtons = document.querySelectorAll('.filter-btn');
filterButtons.forEach(button => {
button.addEventListener('click', () => {
filterButtons.forEach(btn => btn.classList.remove('active', 'bg-mint-600', 'text-white'));
button.classList.add('active', 'bg-mint-600', 'text-white');
const filterValue = button.dataset.filter;
const cards = document.querySelectorAll('.property-card');
cards.forEach(card => {
if (filterValue === 'all' || card.dataset.type === filterValue) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
});
});
});
}
// Contact form submission
if (window.location.pathname.includes('contact.html')) {
document.addEventListener('DOMContentLoaded', function() {
const contactForm = document.getElementById('contactForm');
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
// Get form values
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const phone = document.getElementById('phone').value;
const message = document.getElementById('message').value;
// Simple validation
if (!name || !email || !message) {
alert('Please fill in all required fields.');
return;
}
// Here you would typically send the data to a server
console.log('Form submitted:', { name, email, phone, message });
// Show success message
alert('Thank you for your message! We will contact you soon.');
contactForm.reset();
});
});
} |