Spaces:
Running
Running
сделай многостраничный сайт для агенства по продаже квартир, используй js, стиль минималистичный с преобладанием салатового и белого цветов
43601eb verified Download script.js from afmprod108/greenleaf-estates: direct link, hf CLI and curl.
- Browser
- Download file 5.54 kB
-
https://huggingface.co/spaces/afmprod108/greenleaf-estates/resolve/main/script.js
- Command line
-
hf download hf://spaces/afmprod108/greenleaf-estates/script.js
-
curl -L -o script.js https://huggingface.co/spaces/afmprod108/greenleaf-estates/resolve/main/script.js
5.54 kB
| // 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(); | |
| }); | |
| }); | |
| } |