Skip to content

Commit

Permalink
🐛fix GitHub link breaks on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
soaibsafi committed Jan 3, 2024
1 parent 278cf9b commit 271fe5b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
7 changes: 7 additions & 0 deletions frontend/src/assets/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,10 @@
opacity: 1;
}
}


@media (max-width: 767px) {
.github-icon {
display: none;
}
}
28 changes: 17 additions & 11 deletions frontend/src/components/Utils/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
MDBNavbar,
MDBNavbarBrand,
MDBBtn,
MDBNavbarLink,
MDBNavbarNav,
MDBNavbarToggler,
MDBIcon,
Expand All @@ -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);
Expand Down Expand Up @@ -81,7 +81,7 @@ export default function Navbar({ setEditorValue, setLanguage }) {

const handleUserProfileDelete = async () => {
try {

await deleteProfile()
.then((res) => {
console.log(res)
Expand Down Expand Up @@ -154,24 +154,22 @@ export default function Navbar({ setEditorValue, setLanguage }) {
<MDBNavbarNav right fullWidth={false} className='mb-2 mb-lg-0'>
{isLoggedIn ? (
<>
{/* <MDBBtn rounded color='primary' onClick={handleDrawerOpen}>History</MDBBtn> */}
<MDBNavbarLink
className='link-text me-2'
active aria-current
<MDBBtn
className='mb-2 mb-lg-0 me-lg-2 justify-content-center'
onClick={handleDrawerOpen}
style={{ position: 'relative' }}
style={{ width: 'auto', display: 'flex', alignItems: 'center' }}
>History
</MDBNavbarLink>
</MDBBtn>
<DrawerComponent isOpen={isDrawerOpen} onClose={handleDrawerClose} onItemSelect={handleDrawerItemClick} />
<MDBDropdown className='btn-group' >
<MDBDropdown className='btn-group' style={{ width: 'auto', display: 'flex', alignItems: 'center' }} >
<MDBBtn
color='danger'
onClick={handleLogout}
>
Logout
</MDBBtn>
<MDBDropdownToggle split color='dark'></MDBDropdownToggle>
<MDBDropdownMenu >
<MDBDropdownToggle split color='dark' style={{ flex: '0' }}></MDBDropdownToggle>
<MDBDropdownMenu style={{ minWidth: '200px' }}>
<MDBDropdownItem
link
onClick={handleUserDataDownload}
Expand All @@ -189,6 +187,13 @@ export default function Navbar({ setEditorValue, setLanguage }) {
<MDBBtn rounded color='primary' href='/login'>Login</MDBBtn>
)}

{isMobile && (
<MDBBtn
color='light'
onClick={() => window.open('https://github.com/se-buw/fm-playground', '_blank')}
><FaGithub size={24} style={{ marginRight: '5px' }} />
</MDBBtn>
)}
</MDBNavbarNav>
</MDBCollapse>

Expand All @@ -200,6 +205,7 @@ export default function Navbar({ setEditorValue, setLanguage }) {
style={{ marginRight: '20px' }}
role='button'
/>

</MDBNavbar>

{/* Snackbar component */}
Expand Down

0 comments on commit 271fe5b

Please sign in to comment.