This commit is contained in:
ruchi 2021-04-08 17:00:31 -04:00
parent c489abd9a5
commit 126682db1c
2 changed files with 10 additions and 5 deletions

View file

@ -3,6 +3,7 @@ import Footer from "./shared-components/footer-component/Footer";
import Navbar from "./shared-components/navbar-component/Navbar"; import Navbar from "./shared-components/navbar-component/Navbar";
import { BrowserRouter, Route, Switch } from "react-router-dom"; import { BrowserRouter, Route, Switch } from "react-router-dom";
import i18next from "i18next"; import i18next from "i18next";
import { useTranslation } from "react-i18next";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import HomePage from "./homePage/Homepage"; import HomePage from "./homePage/Homepage";
import ListingsPage from "./listings-page/ListingsPage"; import ListingsPage from "./listings-page/ListingsPage";
@ -30,6 +31,7 @@ function App() {
const currentLanguage = langauges.find( const currentLanguage = langauges.find(
(lang) => lang.code === currentLanguageCode (lang) => lang.code === currentLanguageCode
); );
const { t } = useTranslation();
useEffect(() => { useEffect(() => {
document.body.dir = currentLanguage.dir || "ltr"; document.body.dir = currentLanguage.dir || "ltr";

View file

@ -17,7 +17,7 @@ import {
ComboboxList, ComboboxList,
ComboboxOption, ComboboxOption,
} from "@reach/combobox"; } from "@reach/combobox";
import { formatRelative } from "date-fns"; //import { formatRelative } from "date-fns";
import Select from "react-select"; import Select from "react-select";
import "@reach/combobox/styles.css"; import "@reach/combobox/styles.css";
@ -26,6 +26,8 @@ import * as listingData from "./data/property-data.json";
import "./ListingsPage.css"; import "./ListingsPage.css";
import compassImg from "./compass.svg"; import compassImg from "./compass.svg";
import { withTranslation } from "react-i18next";
const libraries = ["places"]; const libraries = ["places"];
@ -111,7 +113,7 @@ export default function ListingsPage() {
const { isLoaded, loadError } = useLoadScript({ const { isLoaded, loadError } = useLoadScript({
googleMapsApiKey: `https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places&key= googleMapsApiKey: `https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places&key=
AIzaSyC5TiZoTEwEcB_HUZRhe_rXrcSWW1Z5x8I`, AIzaSyC5TiZoTEwEcB_HUZRhe_rXrcSWW1Z5x8I`,
libraries, libraries,
}); });
@ -119,7 +121,7 @@ export default function ListingsPage() {
const [selectedBeds, setSelectedBeds] = useState(null); const [selectedBeds, setSelectedBeds] = useState(null);
const [selectedBaths, setSelectedBaths] = useState(null); const [selectedBaths, setSelectedBaths] = useState(null);
const [markers, setMarkers] = React.useState([]); //const [markers, setMarkers] = React.useState([]);
const [selected, setSelected] = React.useState(null); const [selected, setSelected] = React.useState(null);
const [budget, setBudget] = useState(null); const [budget, setBudget] = useState(null);
@ -157,6 +159,7 @@ export default function ListingsPage() {
setBath(e.value); setBath(e.value);
}; };
const { t } = this.props;
return ( return (
<div className="main_borders"> <div className="main_borders">
@ -203,8 +206,8 @@ export default function ListingsPage() {
> >
{listingData.Properties.map((house) => {listingData.Properties.map((house) =>
(budget >= house.PRICE || !budget) && (budget >= house.PRICE || !budget) &&
(bed == house.BEDS || !bed) && (bed === house.BEDS || !bed) &&
(bath == house.BATHS || !bath) ? ( (bath === house.BATHS || !bath) ? (
<Marker <Marker
key={house.LISTING_ID} key={house.LISTING_ID}
position={{ position={{