Skip to content

Commit

Permalink
Add 's' postfix to Timer field
Browse files Browse the repository at this point in the history
  • Loading branch information
slavikdenis committed Dec 5, 2021
1 parent 5719017 commit 1ed4692
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/settings/SettingTimerField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const SettingTimerField = ({
value,
onChange,
}: SettingTimerFieldProps) => {
const format = (val: number) => `${val}s`;
const parse = (val: string) => Number(val.replace('s', ''));

return (
<FormControl id={fieldId} mb={4}>
<Flex alignItems="center" justifyContent="space-between">
Expand All @@ -60,10 +63,10 @@ const SettingTimerField = ({

<NumberInput
id={fieldId}
value={value}
value={format(value)}
min={5}
max={90}
onChange={(_s, number) => onChange(number)}
onChange={(val) => onChange(parse(val))}
width="85px"
>
<NumberInputField />
Expand Down

0 comments on commit 1ed4692

Please sign in to comment.