pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame^] | 1 | import { Component } from "react"; |
| 2 | import Styles from '../styles/navbar.module.css'; |
| 3 | |
| 4 | class NavBar extends Component { |
| 5 | constructor(props) { |
| 6 | super(props); |
| 7 | this.state = { |
| 8 | isOpen: false |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | toggleVertical(prevState, force=null) { |
| 13 | this.setState(prevState => ({ |
| 14 | isOpen: (force === null) ? !prevState.isOpen : force |
| 15 | })); |
| 16 | } |
| 17 | |
| 18 | render() { |
| 19 | return ( |
| 20 | <> |
| 21 | <div className={Styles.container + " " + (this.state.isOpen ? Styles.containerOpen : null)} onMouseLeave={() => {this.toggleVertical(this.state, false)}}> |
| 22 | <div className={Styles.group}> |
| 23 | <img className={Styles.headerIcon} src="/Icons/CMP.svg" onClick={() => {this.toggleVertical(this.state)}}/> |
| 24 | <a href="/"><img className={Styles.icon} src="/Icons/CMP.svg"/></a> |
| 25 | <a href="/gps"><img className={Styles.icon} src="/Icons/GS.svg"/></a> |
| 26 | <a href="/rsm"><img className={Styles.icon} src="/Icons/RM.svg"/></a> |
| 27 | <a href="/clicksforms"><img className={Styles.icon} src="/Icons/CF.svg"/></a> |
| 28 | </div> |
| 29 | <div className={Styles.group}> |
| 30 | <a href="/"><img className={Styles.icon} src="/Icons/CMP.svg"/></a> |
| 31 | </div> |
| 32 | </div> |
| 33 | </> |
| 34 | ) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | export default NavBar; |