Home properties
This commit is contained in:
+2
-1
@@ -1,13 +1,14 @@
|
|||||||
import Link from 'next/link';
|
|
||||||
import Hero from '../components/Hero';
|
import Hero from '../components/Hero';
|
||||||
import InfoBoxes from '@/components/InfoBoxes';
|
import InfoBoxes from '@/components/InfoBoxes';
|
||||||
import Footer from '@/components/Footer';
|
import Footer from '@/components/Footer';
|
||||||
|
import HomeProperties from '@/components/HomeProperties';
|
||||||
|
|
||||||
const HomePage = () => {
|
const HomePage = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Hero />
|
<Hero />
|
||||||
<InfoBoxes />
|
<InfoBoxes />
|
||||||
|
<HomeProperties />
|
||||||
<Footer />
|
<Footer />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import properties from '@/properties.json';
|
||||||
|
import Link from 'next/link';
|
||||||
|
import PropertyCard from './PropertyCard';
|
||||||
|
|
||||||
|
const HomeProperties = () => {
|
||||||
|
const recentProperties = properties
|
||||||
|
.sort(() => Math.random() - Math.random())
|
||||||
|
.slice(0, 3);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<section class='px-4 py-6'>
|
||||||
|
<div class='container-xl lg:container m-auto'>
|
||||||
|
<h2 class='text-3xl font-bold text-blue-500 mb-6 text-center'>
|
||||||
|
Recent Properties
|
||||||
|
</h2>
|
||||||
|
<div className='grid grid-cols-1 md:grid-cols-3 gap-6'>
|
||||||
|
{recentProperties.length === 0 ? (
|
||||||
|
<p>No Properties Found</p>
|
||||||
|
) : (
|
||||||
|
recentProperties.map((property) => (
|
||||||
|
<PropertyCard key={property._id} property={property} />
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section className='m-auto max-w-lg my-10 px-6'>
|
||||||
|
<Link
|
||||||
|
href='/properties'
|
||||||
|
className='block bg-black text-white text-center py-4 px-6 rounded-xl hover:bg-gray-700'
|
||||||
|
>
|
||||||
|
View All Properties
|
||||||
|
</Link>
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default HomeProperties;
|
||||||
Reference in New Issue
Block a user