Skip to content

Commit

Permalink
Merge pull request #144 from RitehWebTeam/84-geolocation-front
Browse files Browse the repository at this point in the history
84-geolocation-front
  • Loading branch information
marinivosevic authored Jun 9, 2024
2 parents 2d9c66a + 29d8bfe commit e2ea0ff
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions frontend/src/views/SetupPreferences/steps/Step1Preferences.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
import SimpleField from "@/components/forms/SimpleField";
import { useEffect, useState } from "react";



const Step1Preferences = () => {
const [location, setLocation] = useState("");
const getLocationFromBrowser = () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition((position) => {
setLocation(position.coords.latitude + ", " + position.coords.longitude);
});
} else {
console.log("Geolocation is not supported by this browser.");
}
}

useEffect(() => {
getLocationFromBrowser();
});
return (
<div className="flex flex-col gap-6 font-Montserrat">
<div className="flex flex-col gap-2">
Expand All @@ -11,11 +28,14 @@ const Step1Preferences = () => {
placeholder="091 999 999"
/>
</div>

<div className="flex flex-col gap-2">

<SimpleField
label="Where are you from?"
name="location"
placeholder="Please input your location"
value={location}
/>
</div>
<div className="flex flex-col gap-2">
Expand Down

0 comments on commit e2ea0ff

Please sign in to comment.