source: imaps-frontend/src/components/SaveMap/SaveMap.jsx

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[d565449]1import { useState } from 'react';
2import HttpService from '../../scripts/net/HttpService';
3import styles from './SaveMap.module.css';
4
5const SaveMap = ({submitHandler}) => {
6 const [name, setName] = useState('');
7
8 const handleSubmit = (event) => {
9 event.preventDefault();
10 submitHandler(name);
11 };
12
13 return (
14 <>
15 <div className={styles.saveMapContainer}>
16 <form onSubmit={handleSubmit} className={styles.saveMapForm}>
17 <div>
18 <label htmlFor="name">Map Name: </label>
19 <input
20 type="text"
21 id="name"
22 value={name}
23 onChange={(e) => setName(e.target.value)}
24 placeholder="Enter map name"
25 required
26 className={styles.saveMapInput}
27 />
28 </div>
29 <div>
30 <button type="submit" className={styles.saveMapButton}>Save Map</button>
31 </div>
32 </form>
33 </div>
34 </>
35 );
36}
37
38export default SaveMap;
Note: See TracBrowser for help on using the repository browser.