Skip to content

Commit

Permalink
chore: editable coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhart1o1 committed Feb 8, 2024
1 parent 60bba25 commit d8595fd
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions apps/map/components/map/suggest-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ type formProps = {

export function SuggestMapFormSheet({ latitude, longitude }: formProps) {
const [isOpen, setIsOpen] = useState(false)
const [coordinates, setCoordinates] = useState({
latitude: latitude,
longitude: longitude,
})

const [state, formAction] = useFormState<
{
error: boolean
Expand Down Expand Up @@ -72,19 +77,28 @@ export function SuggestMapFormSheet({ latitude, longitude }: formProps) {
required={true}
label="Latitude"
id="latitude"
value={latitude}
value={coordinates.latitude}
placeholder="Latitude"
name="latitude"
type="number"
onChange={(e) => {
setCoordinates({ ...coordinates, latitude: parseFloat(e.target.value) })
}}
/>
<InputComponent
required={true}
label="Longitude"
id="longitude"
value={longitude}
value={coordinates.longitude}
placeholder="Longitude"
name="longitude"
type="number"
onChange={(e) => {
setCoordinates({
...coordinates,
longitude: parseFloat(e.target.value),
})
}}
/>
{state.error && <span className="text-red-600">{state.message}</span>}
<button
Expand Down

0 comments on commit d8595fd

Please sign in to comment.