Skip to content

Commit ca477c6

Browse files
Add description to local state
1 parent ad68dfa commit ca477c6

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

app/modals/AddModal.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ interface IFields {
66
database: string;
77
URI: string;
88
name: string;
9+
description: string;
910
}
1011

1112
interface IDashboard {
@@ -16,7 +17,7 @@ interface AddModalProps {
1617
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
1718
}
1819

19-
type InputElement = React.ChangeEvent<HTMLSelectElement | HTMLInputElement>;
20+
type InputElement = React.ChangeEvent<HTMLSelectElement | HTMLInputElement | HTMLTextAreaElement>;
2021
type FormElement = React.FormEvent<HTMLFormElement>;
2122

2223
const AddModal: React.FC<AddModalProps> = ({ setOpen }) => {
@@ -25,6 +26,7 @@ const AddModal: React.FC<AddModalProps> = ({ setOpen }) => {
2526
database: 'SQL',
2627
URI: '',
2728
name: '',
29+
description: '',
2830
});
2931

3032
// Submit form data and save to database
@@ -43,7 +45,7 @@ const AddModal: React.FC<AddModalProps> = ({ setOpen }) => {
4345
});
4446
};
4547

46-
const { database, URI, name } = fields;
48+
const { database, URI, name, description } = fields;
4749
return (
4850
<div className="add-container">
4951
<div className="add-header">
@@ -83,7 +85,13 @@ const AddModal: React.FC<AddModalProps> = ({ setOpen }) => {
8385
</div>
8486
<div>
8587
<label htmlFor="db-desc">Description</label>
86-
<textarea name="db-desc" id="db-desc" placeholder="Add a short description" />
88+
<textarea
89+
id="db-desc"
90+
name="db-desc"
91+
value={description}
92+
onChange={e => handleChange(e)}
93+
placeholder="Add a short description"
94+
/>
8795
</div>
8896
<button>Submit</button>
8997
</form>

0 commit comments

Comments
 (0)