From 271fe5bd1aa762a5d06387c6a71b1540e3491142 Mon Sep 17 00:00:00 2001 From: Soaibuzzaman Date: Wed, 3 Jan 2024 10:57:59 +0100 Subject: [PATCH] :bug:fix GitHub link breaks on mobile --- frontend/src/assets/style/index.css | 7 +++++++ frontend/src/components/Utils/Nav.jsx | 28 ++++++++++++++++----------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/frontend/src/assets/style/index.css b/frontend/src/assets/style/index.css index d1fa557..34dbe3b 100644 --- a/frontend/src/assets/style/index.css +++ b/frontend/src/assets/style/index.css @@ -89,3 +89,10 @@ opacity: 1; } } + + +@media (max-width: 767px) { + .github-icon { + display: none; + } +} \ No newline at end of file diff --git a/frontend/src/components/Utils/Nav.jsx b/frontend/src/components/Utils/Nav.jsx index 43fac45..19ca91f 100644 --- a/frontend/src/components/Utils/Nav.jsx +++ b/frontend/src/components/Utils/Nav.jsx @@ -4,7 +4,6 @@ import { MDBNavbar, MDBNavbarBrand, MDBBtn, - MDBNavbarLink, MDBNavbarNav, MDBNavbarToggler, MDBIcon, @@ -31,6 +30,7 @@ import axiosAuth from '../../api/axiosAuth.js'; * @returns */ export default function Navbar({ setEditorValue, setLanguage }) { + const isMobile = window.innerWidth = window.matchMedia('(max-width: 767px)').matches; const { isLoggedIn, setIsLoggedIn } = useContext(AuthContext); const [openNavRight, setOpenNavRight] = useState(false); const [isDrawerOpen, setDrawerOpen] = useState(false); @@ -81,7 +81,7 @@ export default function Navbar({ setEditorValue, setLanguage }) { const handleUserProfileDelete = async () => { try { - + await deleteProfile() .then((res) => { console.log(res) @@ -154,24 +154,22 @@ export default function Navbar({ setEditorValue, setLanguage }) { {isLoggedIn ? ( <> - {/* History */} - History - + - + Logout - - + + Login )} + {isMobile && ( + window.open('https://github.com/se-buw/fm-playground', '_blank')} + > + + )} @@ -200,6 +205,7 @@ export default function Navbar({ setEditorValue, setLanguage }) { style={{ marginRight: '20px' }} role='button' /> + {/* Snackbar component */}