Skip to content

Commit

Permalink
chore: update theme toggle icon logic
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsainikhil committed Nov 8, 2020
1 parent 8f83aeb commit 75356f3
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,37 @@ const Header = () => {
</div>
<div className="header-links">
<p>
{colorMode === 'dark' ? (
<Styled.a title="Light Mode" aria-label="Enable Light Mode">
{colorMode === 'light' ? (
<Styled.a
title="Switch to Dark Mode"
aria-label="Switch to Dark Mode"
>
<FiSun
className="theme-icon"
onClick={() => {
setColorMode('light')
setColorMode('dark')
trackGAEvent(
'toggle theme',
`enabled dark theme`,
'icon click'
)
}}
/>
</Styled.a>
) : (
<Styled.a title="Dark Mode" aria-label="Enable Dark Mode">
<Styled.a
title="Switch to Light Mode"
aria-label="Switch to Light Mode"
>
<FiMoon
className="theme-icon"
onClick={() => {
setColorMode('dark')
setColorMode('light')
trackGAEvent(
'toggle theme',
`enabled light theme`,
'icon click'
)
}}
/>
</Styled.a>
Expand Down

0 comments on commit 75356f3

Please sign in to comment.