Merge branch 'main' into feat/protect-users-endpoint
This commit is contained in:
commit
e7c4695a66
7 changed files with 94 additions and 34 deletions
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import { useController } from 'react-hook-form';
|
||||
|
||||
/* eslint-disable react/react-in-jsx-scope */
|
||||
export const Input = ({ control, name, type = 'text', label, ...props }: InputProps) => {
|
||||
export const Input = ({ control, name, type = 'text', label, required, ...props }: InputProps) => {
|
||||
const {
|
||||
field,
|
||||
// fieldState: { invalid, isTouched, isDirty },
|
||||
|
|
@ -10,7 +10,7 @@ export const Input = ({ control, name, type = 'text', label, ...props }: InputPr
|
|||
} = useController({
|
||||
name,
|
||||
control,
|
||||
rules: { required: true },
|
||||
rules: { required },
|
||||
defaultValue: '',
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -134,11 +134,18 @@ export const UserModal = ({ open, onClose, userId, setUserId }: UserModalProps)
|
|||
|
||||
<div className="mt-6 grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6">
|
||||
<div className="sm:col-span-3">
|
||||
<Input control={control} name="name" label="Name" onKeyPress={handleKeyPress} />
|
||||
<Input control={control} name="name" label="Name" onKeyPress={handleKeyPress} required={false} />
|
||||
</div>
|
||||
|
||||
<div className="sm:col-span-3">
|
||||
<Input control={control} name="email" label="Email" type="email" onKeyPress={handleKeyPress} />
|
||||
<Input
|
||||
control={control}
|
||||
name="email"
|
||||
label="Email"
|
||||
type="email"
|
||||
onKeyPress={handleKeyPress}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
{isAdmin && (
|
||||
<>
|
||||
|
|
|
|||
Reference in a new issue