File tree Expand file tree Collapse file tree 7 files changed +54
-30
lines changed Expand file tree Collapse file tree 7 files changed +54
-30
lines changed Original file line number Diff line number Diff line change 1- import React from 'react' ;
1+ import React , { useContext } from 'react' ;
2+ import { ThemeContext } from 'providers/ThemeProvider' ;
23import { Wrapper , Bar } from './styles' ;
34
4- const Hamburger = ( { sidebar, toggle } ) => (
5- < Wrapper sidebar = { sidebar } onClick = { ( ) => toggle ( ! sidebar ) } >
6- < Bar top sidebar = { sidebar } />
7- < Bar mid sidebar = { sidebar } />
8- < Bar bottom sidebar = { sidebar } />
9- </ Wrapper >
10- ) ;
5+ const Hamburger = ( { sidebar, toggle } ) => {
6+
7+ const { theme } = useContext ( ThemeContext ) ;
8+
9+ return (
10+ < Wrapper sidebar = { sidebar } onClick = { ( ) => toggle ( ! sidebar ) } >
11+ < Bar top sidebar = { sidebar } theme = { theme } />
12+ < Bar mid sidebar = { sidebar } theme = { theme } />
13+ < Bar bottom sidebar = { sidebar } theme = { theme } />
14+ </ Wrapper >
15+ )
16+ } ;
1117
1218export default Hamburger ;
Original file line number Diff line number Diff line change @@ -44,24 +44,27 @@ export const Bar = styled.div`
4444 width: 1.6rem;
4545 }
4646
47- ${ ( { top, sidebar } ) =>
47+ ${ ( { top, sidebar, theme } ) =>
4848 top &&
4949 sidebar &&
50- `
50+ `
51+ background-color: ${ ( theme === 'light' ? '#212121' : '#fff' ) } ;
5152 transform: translateY(8px) rotate(-135deg);
53+
5254 ` }
5355
5456 ${ ( { mid, sidebar } ) =>
5557 mid &&
5658 sidebar &&
57- `
58- transform: scale(0);
59- ` }
59+ `
60+ transform: scale(0);
61+ ` }
6062
61- ${ ( { bottom, sidebar } ) =>
63+ ${ ( { bottom, sidebar, theme } ) =>
6264 bottom &&
6365 sidebar &&
64- `
66+ `
67+ background-color: ${ ( theme === 'light' ? '#212121' : '#fff' ) } ;
6568 transform: translateY(-6px) rotate(-45deg);
6669 ` }
6770` ;
Original file line number Diff line number Diff line change 1- import React from 'react' ;
1+ import React , { useContext } from 'react' ;
22import AnchorLink from 'react-anchor-link-smooth-scroll' ;
3+ import { ThemeContext } from 'providers/ThemeProvider' ;
34import ToggleTheme from 'components/theme/Header/ToggleTheme' ;
45import { Wrapper } from './styles' ;
56
6- const NavbarLinks = ( { desktop } ) => (
7- < Wrapper desktop = { desktop } >
8- < AnchorLink href = "#about" > About</ AnchorLink >
9- < AnchorLink href = "#projects" > Projects</ AnchorLink >
10- < AnchorLink href = "#contact" > Contact</ AnchorLink >
11- < ToggleTheme />
12- </ Wrapper >
13- ) ;
7+ const NavbarLinks = ( { desktop } ) => {
8+ const { theme } = useContext ( ThemeContext ) ;
9+
10+ return (
11+ < Wrapper desktop = { desktop } theme = { theme } >
12+ < AnchorLink href = "#about" > About</ AnchorLink >
13+ < AnchorLink href = "#projects" > Projects</ AnchorLink >
14+ < AnchorLink href = "#contact" > Contact</ AnchorLink >
15+ < ToggleTheme />
16+ </ Wrapper >
17+ )
18+
19+ } ;
1420
1521export default NavbarLinks ;
Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ export const Wrapper = styled.div`
44 a {
55 color: #000;
66 text-decoration: none;
7+
8+ @media (max-width: 960px) {
9+ color: ${ ( { theme } ) => ( theme === 'light' ? '#000' : '#fff' ) } ;
10+ }
711 }
812
913 ${ ( { desktop } ) =>
Original file line number Diff line number Diff line change 1- import React from 'react' ;
1+ import React , { useContext } from 'react' ;
2+ import { ThemeContext } from 'providers/ThemeProvider' ;
23import NavbarLinks from '../NavbarLinks' ;
34import { Wrapper } from './styles' ;
45
5- const Sidebar = ( { sidebar, toggle } ) => (
6- < Wrapper active = { sidebar } onClick = { toggle } >
6+ const Sidebar = ( { sidebar, toggle } ) => {
7+ const { theme } = useContext ( ThemeContext ) ;
8+
9+ return (
10+ < Wrapper active = { sidebar } onClick = { toggle } theme = { theme } >
711 < NavbarLinks />
812 </ Wrapper >
9- ) ;
13+ )
14+ } ;
1015
1116export default Sidebar ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export const Wrapper = styled.div`
99 width: 0;
1010 opacity: 0;
1111 height: 100%;
12- background-color: #fff;
12+ background-color: ${ ( { theme } ) => ( theme === 'light' ? ' #fff' : '#212121' ) } ;
1313 transition: all 350ms cubic-bezier(0.6, 0.05, 0.28, 0.91);
1414
1515 ${ ( { active } ) =>
You can’t perform that action at this time.
0 commit comments