From 2c1594227ebf4d5f0b96118d0dd388ffa66fa816 Mon Sep 17 00:00:00 2001 From: fbruc03 <65135023+fbruc03@users.noreply.github.com> Date: Thu, 12 Jan 2023 22:30:41 +0100 Subject: [PATCH] style navbar items --- src/components/Navbar.js | 231 ++++++++++++++++++++++++--------------- 1 file changed, 144 insertions(+), 87 deletions(-) diff --git a/src/components/Navbar.js b/src/components/Navbar.js index f0fc14a..50d626f 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -38,8 +38,10 @@ import { faCode, faPuzzlePiece, faUser, - faFlag, faMicrochip, + faEarthEurope, + faEarthAmericas, + faCaretDown } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import * as Blockly from "blockly"; @@ -48,7 +50,6 @@ import MenuItem from '@mui/material/MenuItem' import Menu from '@mui/material/Menu' import { setLanguage } from "../actions/generalActions"; import { setBoard } from "../actions/boardAction"; -import { Redirect } from "react-router-dom"; const styles = (theme) => ({ drawerWidth: { @@ -138,92 +139,150 @@ class Navbar extends Component { senseBox-Logo
- { { this.setState({ anchorElLang: event.target }) }} - style={{ margin: "0 30px 0 auto" }} - size="large" - sx={{ display: { xs: 'none', md: 'block' } }} - > - - } - { - this.setState({ anchorElLang: null }); - }} - > - { - this.props.setLanguage(event.currentTarget.getAttribute("value")); - this.setState({ anchorElLang: null }); +
+ { + this.props.selectedBoard === "mcu" ? + ( + + ) : ( + + + ) + } + - DE - - { - this.props.setLanguage(event.currentTarget.getAttribute("value")); - this.setState({ anchorElLang: null }); + keepMounted + transformOrigin={{ + vertical: 'top', + horizontal: 'center', }} - > - EN - - - { { this.setState({ anchorElBoard: event.target }) }} - style={{ margin: "0 30px 0 auto" }} - size="large" - sx={{ display: { xs: 'none', md: 'block' } }} - > - - } - { this.setState({ anchorElBoard: null }); }} - > - { - this.props.setBoard(event.currentTarget.getAttribute("value")); + open={Boolean(this.state.anchorElBoard)} + onClose={() => { this.setState({ anchorElBoard: null }); }} > - MCU - - { - this.props.setBoard(event.currentTarget.getAttribute("value")); - this.setState({ anchorElBoard: null }); + { + this.props.setBoard(event.currentTarget.getAttribute("value")); + this.setState({ anchorElBoard: null }); + }} + > + MCU + + { + this.props.setBoard(event.currentTarget.getAttribute("value")); + this.setState({ anchorElBoard: null }); + }} + > + mini + + +
+
+ { + this.props.language === "en_US" ? + ( + + ) : ( + + + ) + } + { + this.setState({ anchorElLang: null }); }} > - MINI - - + { + this.props.setLanguage(event.currentTarget.getAttribute("value")); + this.setState({ anchorElLang: null }); + }} + > + Deutsch + + { + this.props.setLanguage(event.currentTarget.getAttribute("value")); + this.setState({ anchorElLang: null }); + }} + > + English + +
+
{isHome ? ( { this.openTour(); }} - style={{ margin: "0 30px 0 auto" }} size="large"> @@ -246,7 +304,6 @@ class Navbar extends Component { onClick={() => { this.openTour(); }} - style={{ margin: "0 30px 0 auto" }} size="large"> @@ -294,9 +351,9 @@ class Navbar extends Component {
- - {Blockly.Msg.navbar_settings} - + + {Blockly.Msg.navbar_settings} + { @@ -312,7 +369,7 @@ class Navbar extends Component { (