Skip to content

Commit 5acf0b1

Browse files
committed
feat(handle text area): add bug fix text area
1 parent 52e82ea commit 5acf0b1

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

web/src/components/internal-ui/Input.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
import { useFormContext } from "react-hook-form";
2-
import { BasicGenFields } from "../../features/constants";
2+
import { BasicGenFields, BugFixFields } from "../../features/constants";
33
import { validateForm } from "../../utils/formValidator";
44

55
interface Props {
6-
fieldName: BasicGenFields;
6+
fieldName: string;
77
label?: string;
88
placeholder?: string;
99
}
1010

11-
const Input = ({ fieldName, label, placeholder }: Props) => {
11+
const Input = ({ fieldName, label, placeholder = "Placeholder" }: Props) => {
1212
const {
1313
register,
1414
formState: { errors },
1515
} = useFormContext();
1616

17+
const showTextArea =
18+
fieldName === BasicGenFields.INPUT ||
19+
fieldName === BugFixFields.BUG_DESCRIPTION;
20+
1721
const defaultStyle =
1822
"border border-stone-600 bg-stone-900 rounded-md flex h-auto p-4";
1923

@@ -23,7 +27,7 @@ const Input = ({ fieldName, label, placeholder }: Props) => {
2327
<div className="label">
2428
<span className="label-text">{label}</span>
2529
</div>
26-
{fieldName !== BasicGenFields.INPUT ? (
30+
{!showTextArea ? (
2731
<input
2832
className={defaultStyle}
2933
{...register(fieldName, validateForm(fieldName))}

0 commit comments

Comments
 (0)