Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit 962ef15

Browse files
author
Manuel Proß
committed
wip(FE): add custom input field
1 parent 21a948e commit 962ef15

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
type InputProps = {
2+
type: string;
3+
label?: string;
4+
id?: string;
5+
required?: boolean;
6+
hasError?: boolean;
7+
placeholder?: string;
8+
value: string;
9+
name: string;
10+
onChange: (value: string) => void;
11+
};
12+
13+
export default function Input({ type, label, id, required, hasError, placeholder, value, name, onChange }: InputProps) {
14+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
15+
const { value } = e.target;
16+
onChange(value);
17+
};
18+
return (
19+
<div>
20+
{label && <label htmlFor={id}>{label}</label>}
21+
<input
22+
className="border-[1px] border-solid border-gray-1"
23+
type={type}
24+
value={value}
25+
name={name}
26+
placeholder={placeholder}
27+
onChange={handleChange}
28+
required={required}
29+
/>
30+
{hasError}
31+
</div>
32+
);
33+
}

0 commit comments

Comments
 (0)