From ab48fbe576e9c2eb2bd10f2c15c641173c93e1d6 Mon Sep 17 00:00:00 2001 From: DamyanBG Date: Thu, 25 Apr 2024 18:57:31 +0300 Subject: [PATCH] create home details styling --- src/components/Homes/HomeDetails.jsx | 120 +++++++++++++++--- src/components/Homes/HomeDetails.scss | 8 -- src/components/Homes/HomeSuggestions.jsx | 3 + src/components/Homes/home-details.module.scss | 72 +++++++++++ 4 files changed, 178 insertions(+), 25 deletions(-) delete mode 100644 src/components/Homes/HomeDetails.scss create mode 100644 src/components/Homes/home-details.module.scss diff --git a/src/components/Homes/HomeDetails.jsx b/src/components/Homes/HomeDetails.jsx index a84df37..e3c728a 100644 --- a/src/components/Homes/HomeDetails.jsx +++ b/src/components/Homes/HomeDetails.jsx @@ -1,21 +1,19 @@ -import './Homes.scss'; -import exampleHomePhoto from '../../images/home-main-photo-example.jpg'; +import { Link, useSearchParams } from 'react-router-dom'; import { useContext, useEffect, useState, lazy } from 'react'; -import './HomeDetails.scss'; + import { hostUrl } from '@/utils/urls'; -import { Link } from 'react-router-dom'; +import exampleHomePhoto from '../../images/home-main-photo-example.jpg'; import VisitationsTable from '../..//common/VisitationsTable'; import { UserContext } from '../../context/UserContext'; import HomeSuggestions from './HomeSuggestions'; -import { useLocation } from 'react-router-dom'; -const MapView = lazy(() => import('@/common/MapView')); +import styles from "./home-details.module.scss" + +const MapView = lazy(() => import('../../common/MapView')); export default function HomeDetails() { - const location = useLocation(); - const params = new URLSearchParams(location.search); - // const params = new URLSearchParams(window.location.search); - const homeId = params.get('homeId'); + const searchParams = useSearchParams()[0] + const homeId = searchParams.get('homeId'); const [homeDetails, setHomeDetails] = useState({}); const [visitations, setVisitations] = useState([]); @@ -33,9 +31,37 @@ export default function HomeDetails() { useEffect(fetchHomeDetails, [homeId]); return ( -
-
-
+
+
+
+
+ Home { + e.target.onError = null; + e.target.src = exampleHomePhoto; + }} + /> +
+
+ +
+ {homeDetails.latitude && homeDetails.longitude && ( + + )} +
+ +
+
+ +
+
+ +
+
+ + {/*
Home )} -
+
*/} +
+ +
+
+
+

Overview

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
City{homeDetails.city}
Neighborhood{homeDetails.neighborhood}
Address{homeDetails.address}
Area{homeDetails.area}
Price{homeDetails.price}
Bedrooms{homeDetails.bedrooms}
Bathrooms{homeDetails.bathrooms}
Garages{homeDetails.garages}
Year Build{homeDetails.year}
Views{homeDetails.home_views}
+ +
+
+

Description

+
+

{homeDetails.description}

+
+
+
+ +
- {homeDetails.latitude && homeDetails.longitude && ( - - )} +
); diff --git a/src/components/Homes/HomeDetails.scss b/src/components/Homes/HomeDetails.scss deleted file mode 100644 index 8c41982..0000000 --- a/src/components/Homes/HomeDetails.scss +++ /dev/null @@ -1,8 +0,0 @@ -.visitation-table-wrapper{ - width: 100%; - margin-top: 10px; - - .visitation-table-header th { - text-align: start; - } -} diff --git a/src/components/Homes/HomeSuggestions.jsx b/src/components/Homes/HomeSuggestions.jsx index b597222..b03fd86 100644 --- a/src/components/Homes/HomeSuggestions.jsx +++ b/src/components/Homes/HomeSuggestions.jsx @@ -21,6 +21,9 @@ const HomeSuggestions = ({ homeId }) => { return ( suggestions.length > 0 && (
+
+

Closest Properties

+
{suggestions.slice(0, 3).map((homeSug) => (