Skip to content

Commit

Permalink
set lat and lon inputs to number type
Browse files Browse the repository at this point in the history
  • Loading branch information
z0ccc committed Dec 30, 2022
1 parent 56369c2 commit d492304
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/Popup/Components/DebouncedInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface DebouncedInputProps {
setValue: Dispatch<SetStateAction<string>>
onChange: () => void
mb?: string
type?: string
}

const DebouncedInput = ({
Expand All @@ -19,6 +20,7 @@ const DebouncedInput = ({
setValue,
onChange,
mb,
type = 'text',
}: DebouncedInputProps) => {
const debouncedChangeHandler = useMemo(
() =>
Expand All @@ -38,7 +40,13 @@ const DebouncedInput = ({
return (
<Box>
<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>
)
}
Expand Down
4 changes: 3 additions & 1 deletion src/Popup/Pages/LocationPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 Checkbox from '../../Components/CheckBox'
import DebouncedInput from '../../Components/DebouncedInput'
Expand Down Expand Up @@ -231,6 +231,7 @@ const LocationPage = ({ tab, setTab }: LocationPageProps) => {
value={lat}
setValue={setLatitude}
onChange={changeInputText}
type="number"
/>
<DebouncedInput
name="lon"
Expand All @@ -239,6 +240,7 @@ const LocationPage = ({ tab, setTab }: LocationPageProps) => {
setValue={setLongitude}
onChange={changeInputText}
mb="12px"
type="number"
/>
</Flex>
</Box>
Expand Down

0 comments on commit d492304

Please sign in to comment.