@@ -6,6 +6,7 @@ interface IFields {
66 database: string;
77 URI: string;
88 name: string;
9+ description: string;
910}
1011
1112interface 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 >;
2021type FormElement = React.FormEvent<HTMLFormElement>;
2122
2223const 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,23 +45,24 @@ 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">
5052 <h2>Add an Application</h2>
5153 <p>Enter the database information used to track the service</p>
5254 </div>
5355 <form onSubmit={handleSubmit}>
54- <div className="input-field">
55- <label htmlFor="db-type">Type</label>
56+ <p>Required*</p>
57+ <div>
58+ <label htmlFor="db-type">Type<span>*</span></label>
5659 <select id="db-type" name="database" value={database} onChange={e => handleChange(e)}>
5760 <option value="SQL">SQL</option>
5861 <option value="MongoDB">MongoDB</option>
5962 </select>
6063 </div>
61- <div className="input-field" >
62- <label htmlFor="db-uri">URI</label>
64+ <div>
65+ <label htmlFor="db-uri">URI<span>*</span>< /label>
6366 <input
6467 id="db-uri"
6568 name="URI"
@@ -69,8 +72,8 @@ const AddModal: React.FC<AddModalProps> = ({ setOpen }) => {
6972 required
7073 />
7174 </div>
72- <div className="input-field" >
73- <label htmlFor="db-name">Name</label>
75+ <div>
76+ <label htmlFor="db-name">Name<span>*</span>< /label>
7477 <input
7578 id="db-name"
7679 type="text"
@@ -81,6 +84,16 @@ const AddModal: React.FC<AddModalProps> = ({ setOpen }) => {
8184 required
8285 />
8386 </div>
87+ <div>
88+ <label htmlFor="db-desc">Description</label>
89+ <textarea
90+ id="db-desc"
91+ name="db-desc"
92+ value={description}
93+ onChange={e => handleChange(e)}
94+ placeholder="Add a short description"
95+ />
96+ </div>
8497 <button>Submit</button>
8598 </form>
8699 </div>
0 commit comments