Skip to content

Commit

Permalink
fix: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
tuanddd committed Feb 20, 2024
1 parent 45ff982 commit eee336e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions apps/mochi-web/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import {
LinkSquircledSolid,
WalletAddSolid,
ScanLine,
MoonLine,
SunLine,
} from '@mochi-ui/icons'
import NotificationList from '~cpn/NotificationList'
import clsx from 'clsx'
Expand All @@ -57,6 +59,7 @@ import { useFetchChangelogLatest } from '~hooks/app/useFetchChangelogLatest'
import { MobileNavAccordionItem } from './MobileNavAccordionItem'
import { DashboardMobileSidebar } from './DashboardMobileSidebar'
import { useIsNavOpenStore } from './util'
import { useTheme } from '~context/theme'

Check failure on line 62 in apps/mochi-web/components/Header/Header.tsx

View workflow job for this annotation

GitHub Actions / ESLint

`~context/theme` import should occur before import of `./MobileNavAccordionItem`

const authenticatedRoute = [
ROUTES.MY_PROFILE,
Expand Down Expand Up @@ -95,6 +98,7 @@ export const Header = () => {
const { profile, isLoggedIn, socials } = useLoginWidget()
const { setIsNavOpen } = useIsNavOpenStore()
const { data: changelogData } = useFetchChangelogLatest()
const { theme, setTheme } = useTheme()

const redirectToTipWidget = useCallback(async () => {
if (pathname !== ROUTES.HOME) {
Expand Down Expand Up @@ -467,6 +471,20 @@ export const Header = () => {
>
<div className="w-full h-6 bg-[#eeedec]" />
</div>,
<IconButton
label="dark/light mode toggle button"
key="dark/light mode toggle"
variant="outline"
color="neutral"
className="!p-1.5"
onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}
>
{theme === 'light' ? (
<MoonLine className="w-5 h-5" />
) : (
<SunLine className="w-5 h-5" />
)}
</IconButton>,
<LoginPopover key="desktop-login-popover" />,
]),
]
Expand Down
4 changes: 4 additions & 0 deletions packages/icons/src/svg/line/moon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packages/icons/src/svg/line/sun.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit eee336e

Please sign in to comment.