Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x 124x | import { AnyFieldApi } from '@tanstack/react-form';
import { Hint, Input, Label } from '@/components/ui';
interface Props {
field: AnyFieldApi;
}
export const NickNameField = ({ field }: Props) => {
const isInvalid = !field.state.meta.isValid;
const fieldId = 'profile-nickname';
return (
<div className='flex w-full flex-col gap-1'>
<Label htmlFor={fieldId} required>
닉네임
</Label>
<Input
id={fieldId}
className='bg-mono-white focus:border-mint-500 rounded-2xl border border-gray-300'
placeholder='닉네임을 입력해주세요'
required
type='text'
value={field.state.value}
onChange={(e) => field.handleChange(e.target.value)}
/>
{isInvalid && <Hint message={field.state.meta.errors[0].message} />}
</div>
);
};
|