source: imaps-frontend/src/components/KeyMappingsGuidePanel/KeymapPanel.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.1 KB
Line 
1import { useState } from "react";
2import styles from './KeymapPanel.module.css'; // Import the CSS module
3
4const keyMappings = [
5 { key: 'W', info: 'Move Up' },
6 { key: 'A', info: 'Move Left' },
7 { key: 'S', info: 'Move Down' },
8 { key: 'D', info: 'Move Right' },
9 { key: 'Space', info: 'Jump / Shoot' },
10 { key: 'E', info: 'Interact' },
11 { key: 'Q', info: 'Switch Weapon' }
12];
13
14const KeyboardPanel = () => {
15 const [hoveredKey, setHoveredKey] = useState(null);
16
17 return (
18 <div className={styles.keyboardPanel}>
19 {keyMappings.map((keyItem, index) => (
20 <button
21 key={index}
22 className={styles.keyButton}
23 onMouseEnter={() => setHoveredKey(keyItem.info)}
24 onMouseLeave={() => setHoveredKey(null)}
25 >
26 {keyItem.key}
27 </button>
28 ))}
29
30 {hoveredKey && (
31 <div className={styles.keyInfo}>
32 {hoveredKey}
33 </div>
34 )}
35 </div>
36 );
37};
38
39export default KeyboardPanel;
Note: See TracBrowser for help on using the repository browser.