-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
100 additions
and
42 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,61 @@ | ||
import React from 'react'; | ||
import Container from 'react-bootstrap/Container'; | ||
import Nav from 'react-bootstrap/Nav'; | ||
import Navbar from 'react-bootstrap/Navbar'; | ||
import NavDropdown from 'react-bootstrap/NavDropdown'; | ||
import InputGroup from 'react-bootstrap/InputGroup'; | ||
import Form from 'react-bootstrap/Form'; | ||
import Button from 'react-bootstrap/Button'; | ||
import Box from '@mui/material/Box'; | ||
import AppBar from '@mui/material/AppBar'; | ||
import Toolbar from '@mui/material/Toolbar'; | ||
import { Typography } from '@mui/material'; | ||
import Button from '@mui/material/Button'; | ||
import Link from '@mui/material/Link'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import LightModeIcon from '@mui/icons-material/LightMode'; | ||
import DarkModeIcon from '@mui/icons-material/DarkMode'; | ||
import AssignmentIndTwoToneIcon from '@mui/icons-material/AssignmentIndTwoTone'; | ||
import { useTheme, useMediaQuery } from '@mui/material'; | ||
import { useThemeContext } from '../themeContextProvider'; | ||
|
||
function ThemeToggleButton() { | ||
const { mode, toggleTheme } = useThemeContext(); | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<IconButton onClick={toggleTheme} sx={{color: theme.palette.accent.main}}> | ||
{mode === 'dark' ? <DarkModeIcon /> : <LightModeIcon />} | ||
</IconButton> | ||
); | ||
}; | ||
|
||
export default function NavbarComponent() { | ||
const theme = useTheme(); | ||
|
||
const navbarBgColor = theme.palette.primary.main; | ||
|
||
return ( | ||
<> | ||
<Navbar bg="dark" variant="dark" style={{ zIndex: 1000 }}> | ||
<Container direction="horizontal"> | ||
<Navbar.Brand href='#home' className="mx-2"> {/* logo goes here */}</Navbar.Brand> | ||
<Form className="d-flex mx-2"> | ||
<InputGroup> | ||
<Form.Control | ||
placeholder="search" | ||
aria-label='search' | ||
aria-describedby='search' /> | ||
</InputGroup> | ||
</Form> | ||
<Nav className="d-flex align-items-center"> | ||
<Nav.Link href="#tasks" className="mx-2">Tasks</Nav.Link> | ||
<Nav.Link href="#schedule" className="mx-2">Schedule</Nav.Link> | ||
</Nav> | ||
|
||
</Container> | ||
</Navbar> | ||
</> | ||
<Box> | ||
<AppBar position="fixed" sx={{ | ||
justifyContent: "center", | ||
zIndex: (theme) => theme.zIndex.drawer + 1, | ||
display: 'flex', | ||
width: '100%', | ||
alignItems: 'center', | ||
backgroundColor: navbarBgColor, | ||
boxShadow: 'none', | ||
backdropFilter: 'blur(10px)', // Blur effect | ||
WebkitBackdropFilter: 'blur(10px)', // safari compatibility | ||
}}> | ||
<Toolbar sx={{width: '90%', display: 'flex', justifyContent: 'space-between'}}> | ||
<Box sx={{ display: 'flex', alignItems: 'center' }}> | ||
<Link to="/" sx={{textDecoration: 'none'}}><AssignmentIndTwoToneIcon sx={{ color: theme.palette.accent.main }}/></Link> | ||
</Box> | ||
<Box sx={{ display: 'flex', alignItems: 'center' }}> | ||
<Link> | ||
<Button sx={{ mx: 1, textTransform: 'none', color: theme.palette.accent.main }} disableElevation>tasks</Button> | ||
</Link> | ||
<Link> | ||
<Button sx={{ mx: 1, textTransform: 'none', color: theme.palette.accent.main }} disableElevation>schedule</Button> | ||
</Link> | ||
<ThemeToggleButton /> | ||
</Box> | ||
</Toolbar> | ||
</AppBar> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { createContext, useMemo, useState, useContext } from 'react'; | ||
import { ThemeProvider, createTheme } from '@mui/material/styles'; | ||
import CssBaseline from '@mui/material/CssBaseline'; | ||
import { lightTheme, darkTheme } from './theme'; | ||
|
||
// Create a context for the theme | ||
const ThemeContext = createContext(); | ||
|
||
export const useThemeContext = () => useContext(ThemeContext); | ||
|
||
export const ThemeContextProvider = ({ children }) => { | ||
const [mode, setMode] = useState('light'); | ||
|
||
const toggleTheme = () => { | ||
setMode((prevMode) => (prevMode === 'light' ? 'dark' : 'light')); | ||
}; | ||
|
||
const theme = useMemo(() => (mode === 'light' ? createTheme(lightTheme) : createTheme(darkTheme)), [mode]); | ||
|
||
return ( | ||
<ThemeContext.Provider value={{ mode, toggleTheme }}> | ||
<ThemeProvider theme={theme}> | ||
<CssBaseline /> | ||
{children} | ||
</ThemeProvider> | ||
</ThemeContext.Provider> | ||
); | ||
}; |