Skip to content

Commit

Permalink
fix: use resolvedTheme boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
kamescg committed Aug 31, 2023
1 parent 016205c commit db16994
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion components/layout/main-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function MainNav() {
<Link href="/" className="mr-6 flex items-center space-x-2">
<LightDarkImage
LightImage="/logo-dark.png"
DarkImage="/logo-white.png"
DarkImage="/logo-light.png"
alt="TurboETH"
height={32}
width={32}
Expand Down
8 changes: 4 additions & 4 deletions components/layout/mobile-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export function MobileNav() {
<div className="flex w-full items-center justify-between md:hidden">
<Link href="/" className="mr-6 flex items-center space-x-2">
<LightDarkImage
LightImage="/logo-fill.png"
DarkImage="/logo-fill.png"
LightImage="/logo-dark.png"
DarkImage="/logo-light.png"
alt="TurboETH"
height={32}
width={32}
Expand All @@ -58,8 +58,8 @@ export function MobileNav() {
onOpenChange={setOpen}
>
<LightDarkImage
LightImage="/logo-fill.png"
DarkImage="/logo-fill.png"
LightImage="/logo-dark.png"
DarkImage="/logo-light.png"
alt="TurboETH"
height={32}
width={32}
Expand Down
4 changes: 2 additions & 2 deletions components/shared/is-dark-theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ interface IsDarkThemeProps {
}

export const IsDarkTheme = ({ children }: IsDarkThemeProps) => {
const { theme } = useTheme()
const { resolvedTheme } = useTheme()

if (theme !== "light") return <>{children}</>
if (resolvedTheme === "dark") return <>{children}</>

return null
}
4 changes: 2 additions & 2 deletions components/shared/is-light-theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ interface IsLightThemeProps {
}

export const IsLightTheme = ({ children }: IsLightThemeProps) => {
const { theme } = useTheme()
const { resolvedTheme } = useTheme()

if (theme === "light") return <>{children}</>
if (resolvedTheme === "light") return <>{children}</>

return null
}
6 changes: 2 additions & 4 deletions components/shared/light-dark-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ const LightDarkImage = ({
width,
className,
}: LightDarkImageProps) => {
const { theme } = useTheme()

console.log(theme, 'themetheme')
const { resolvedTheme } = useTheme()

let imageUrl = LightImage
if (theme === "dark" || theme === "system" ) {
if (resolvedTheme === "dark") {
imageUrl = DarkImage
}

Expand Down
File renamed without changes

0 comments on commit db16994

Please sign in to comment.