source: imaps-frontend/src/components/MapControls/MapControls.jsx@ d565449

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

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.5 KB
Line 
1import React, { useState } from "react";
2import styles from "./MapControls.module.css";
3import plusIcon from "../../assets/plus_icon.png";
4import minusIcon from "../../assets/minus_icon.png";
5import floorIcon from "../../assets/floor_icon.png";
6
7export default function MapControls({ onZoomIn, onZoomOut, onFloorChange }) {
8 const [currentFloor, setCurrentFloor] = useState(1); // Starting floor
9
10 // Handle floor selection
11 const handleFloorChange = (newFloor) => {
12 setCurrentFloor(newFloor);
13 if (onFloorChange) {
14 onFloorChange(newFloor);
15 }
16 };
17
18 return (
19 <div className={styles.mapControl}>
20 {/* Zoom Controls */}
21 <div className={styles.zoomControls}>
22 <button onClick={onZoomIn} className={styles.zoomButton}>
23 <img src={plusIcon} alt="Zoom In" />
24 </button>
25 <button onClick={onZoomOut} className={styles.zoomButton}>
26 <img src={minusIcon} alt="Zoom Out" />
27 </button>
28 </div>
29
30 {/* Floor Selector */}
31 <div className={styles.floorSelector}>
32 <img src={floorIcon} alt="Floor Icon" className={styles.floorIcon} />
33 <select
34 value={currentFloor}
35 onChange={(e) => handleFloorChange(parseInt(e.target.value, 10))}
36 className={styles.floorDropdown}
37 >
38 <option value={1}>1F</option>
39 <option value={2}>2F</option>
40 <option value={3}>3F</option>
41 <option value={4}>4F</option>
42 </select>
43 </div>
44 </div>
45 );
46}
Note: See TracBrowser for help on using the repository browser.