set lat and lon inputs to number type

This commit is contained in:
z0ccc 2022-12-29 19:59:06 -05:00
parent 56369c2914
commit d492304870
2 changed files with 12 additions and 2 deletions

View file

@ -10,6 +10,7 @@ interface DebouncedInputProps {
setValue: Dispatch<SetStateAction<string>> setValue: Dispatch<SetStateAction<string>>
onChange: () => void onChange: () => void
mb?: string mb?: string
type?: string
} }
const DebouncedInput = ({ const DebouncedInput = ({
@ -19,6 +20,7 @@ const DebouncedInput = ({
setValue, setValue,
onChange, onChange,
mb, mb,
type = 'text',
}: DebouncedInputProps) => { }: DebouncedInputProps) => {
const debouncedChangeHandler = useMemo( const debouncedChangeHandler = useMemo(
() => () =>
@ -38,7 +40,13 @@ const DebouncedInput = ({
return ( return (
<Box> <Box>
<Label htmlFor={name}>{title}</Label> <Label htmlFor={name}>{title}</Label>
<Input name={name} value={value} onChange={changeInputText} mb={mb} /> <Input
name={name}
value={value}
onChange={changeInputText}
mb={mb}
type={type}
/>
</Box> </Box>
) )
} }

View file

@ -1,5 +1,5 @@
import { useState, useEffect, ChangeEvent, useCallback } from 'react' import { useState, useEffect, ChangeEvent, useCallback } from 'react'
import { Box, Button, Flex, Label, Radio, Select } from 'theme-ui' import { Box, Button, Flex, Label, Select } from 'theme-ui'
import Page from '../../Components/Page' import Page from '../../Components/Page'
import Checkbox from '../../Components/CheckBox' import Checkbox from '../../Components/CheckBox'
import DebouncedInput from '../../Components/DebouncedInput' import DebouncedInput from '../../Components/DebouncedInput'
@ -231,6 +231,7 @@ const LocationPage = ({ tab, setTab }: LocationPageProps) => {
value={lat} value={lat}
setValue={setLatitude} setValue={setLatitude}
onChange={changeInputText} onChange={changeInputText}
type="number"
/> />
<DebouncedInput <DebouncedInput
name="lon" name="lon"
@ -239,6 +240,7 @@ const LocationPage = ({ tab, setTab }: LocationPageProps) => {
setValue={setLongitude} setValue={setLongitude}
onChange={changeInputText} onChange={changeInputText}
mb="12px" mb="12px"
type="number"
/> />
</Flex> </Flex>
</Box> </Box>