Skip to content

Commit

Permalink
Change text field usages to number field
Browse files Browse the repository at this point in the history
  • Loading branch information
zephraph committed Nov 15, 2023
1 parent ae8218d commit d59ccb6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion app/components/form/fields/DiskSizeField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export function DiskSizeField<
return (
<NumberField
units="GiB"
type="number"
required={required}
name={name}
min={minSize}
Expand Down
4 changes: 2 additions & 2 deletions app/forms/firewall-rules-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
SideModalForm,
TextField,
} from 'app/components/form'
import { NumberField } from 'app/components/form/fields/NumberField'
import { useForm, useVpcSelector } from 'app/hooks'

export type FirewallRuleValues = {
Expand Down Expand Up @@ -151,8 +152,7 @@ export const CommonFields = ({ error, control }: CommonFieldsProps) => {

<FormDivider />

<TextField
type="number"
<NumberField
name="priority"
helpText="Must be 0&ndash;65535"
required
Expand Down
7 changes: 3 additions & 4 deletions app/forms/instance-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
TextField,
type DiskTableItem,
} from 'app/components/form'
import { NumberField } from 'app/components/form/fields/NumberField'
import { getProjectSelector, useForm, useProjectSelector, useToast } from 'app/hooks'
import { pb } from 'app/util/path-builder'

Expand Down Expand Up @@ -246,8 +247,7 @@ export function CreateInstanceForm() {
</Tabs.Content>

<Tabs.Content value="custom">
<TextField
type="number"
<NumberField
required
label="CPUs"
name="ncpus"
Expand All @@ -263,9 +263,8 @@ export function CreateInstanceForm() {
}
}}
/>
<TextField
<NumberField
units="GiB"
type="number"
required
label="Memory"
name="memory"
Expand Down
1 change: 1 addition & 0 deletions libs/ui/lib/number-input/NumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const NumberInput = React.forwardRef<
{...groupProps}
>
<input
type="number"
{...inputProps}
ref={mergeRefs([forwardedRef, inputRef])}
className={cn(
Expand Down

0 comments on commit d59ccb6

Please sign in to comment.