mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-16 04:29:32 +02:00
feat: make responsive
This commit is contained in:
@@ -1,15 +1,57 @@
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import AppBar from '@mui/material/AppBar';
|
||||
import Toolbar from '@mui/material/Toolbar';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import Button from '@mui/material/Button';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import MenuIcon from '@mui/icons-material/Menu';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import githubIcon from '@assets/github-mark.png'; // Adjust the path to your GitHub icon
|
||||
import { Stack } from '@mui/material';
|
||||
import {
|
||||
Stack,
|
||||
Drawer,
|
||||
List,
|
||||
ListItem,
|
||||
ListItemText,
|
||||
ListItemButton
|
||||
} from '@mui/material';
|
||||
import useMediaQuery from '@mui/material/useMediaQuery';
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
|
||||
const Navbar: React.FC = () => {
|
||||
const navigate = useNavigate();
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||
|
||||
const toggleDrawer = (open: boolean) => () => {
|
||||
setDrawerOpen(open);
|
||||
};
|
||||
|
||||
const drawerList = (
|
||||
<List>
|
||||
<ListItemButton onClick={() => navigate('/features')}>
|
||||
<ListItemText primary="Features" />
|
||||
</ListItemButton>
|
||||
<ListItemButton onClick={() => navigate('/about-us')}>
|
||||
<ListItemText primary="About Us" />
|
||||
</ListItemButton>
|
||||
<ListItemButton
|
||||
component="a"
|
||||
href="https://github.com/iib0011/omni-tools"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<img
|
||||
src={githubIcon}
|
||||
alt="GitHub"
|
||||
style={{ height: '24px', marginRight: '8px' }}
|
||||
/>
|
||||
<Typography variant="button">Star us</Typography>
|
||||
</ListItemButton>
|
||||
</List>
|
||||
);
|
||||
|
||||
return (
|
||||
<AppBar
|
||||
position="static"
|
||||
@@ -24,37 +66,52 @@ const Navbar: React.FC = () => {
|
||||
>
|
||||
OmniTools
|
||||
</Typography>
|
||||
<Stack direction={'row'}>
|
||||
<Button color="inherit">
|
||||
<Link
|
||||
to="/features"
|
||||
style={{ textDecoration: 'none', color: 'inherit' }}
|
||||
{isMobile ? (
|
||||
<>
|
||||
<IconButton color="inherit" onClick={toggleDrawer(true)}>
|
||||
<MenuIcon />
|
||||
</IconButton>
|
||||
<Drawer
|
||||
anchor="right"
|
||||
open={drawerOpen}
|
||||
onClose={toggleDrawer(false)}
|
||||
>
|
||||
Features
|
||||
</Link>
|
||||
</Button>
|
||||
<Button color="inherit">
|
||||
<Link
|
||||
to="/about-us"
|
||||
style={{ textDecoration: 'none', color: 'inherit' }}
|
||||
{drawerList}
|
||||
</Drawer>
|
||||
</>
|
||||
) : (
|
||||
<Stack direction={'row'}>
|
||||
<Button color="inherit">
|
||||
<Link
|
||||
to="/features"
|
||||
style={{ textDecoration: 'none', color: 'inherit' }}
|
||||
>
|
||||
Features
|
||||
</Link>
|
||||
</Button>
|
||||
<Button color="inherit">
|
||||
<Link
|
||||
to="/about-us"
|
||||
style={{ textDecoration: 'none', color: 'inherit' }}
|
||||
>
|
||||
About Us
|
||||
</Link>
|
||||
</Button>
|
||||
<IconButton
|
||||
color="primary"
|
||||
href="https://github.com/iib0011/omni-tools"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
About Us
|
||||
</Link>
|
||||
</Button>
|
||||
<IconButton
|
||||
color="primary"
|
||||
href="https://github.com/iib0011/omni-tools"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<img
|
||||
src={githubIcon}
|
||||
alt="GitHub"
|
||||
style={{ height: '24px', marginRight: '8px' }}
|
||||
/>
|
||||
<Typography variant="button">Star us</Typography>
|
||||
</IconButton>
|
||||
</Stack>
|
||||
<img
|
||||
src={githubIcon}
|
||||
alt="GitHub"
|
||||
style={{ height: '24px', marginRight: '8px' }}
|
||||
/>
|
||||
<Typography variant="button">Star us</Typography>
|
||||
</IconButton>
|
||||
</Stack>
|
||||
)}
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
);
|
||||
|
Reference in New Issue
Block a user