+
)
diff --git a/client/app/components/header/controls.tsx b/client/app/components/header/controls.tsx
index ba949952..0fa00a0d 100644
--- a/client/app/components/header/controls.tsx
+++ b/client/app/components/header/controls.tsx
@@ -1,18 +1,14 @@
import React, { useEffect, useState } from "react"
import MoonIcon from "@geist-ui/icons/moon"
import SunIcon from "@geist-ui/icons/sun"
-// import { useAllThemes, useTheme } from '@geist-ui/core'
import styles from "./header.module.css"
import { Select } from "@geist-ui/core/dist"
-import { useTheme } from "next-themes"
+import { useTheme } from "@components/theme/ThemeClientContextProvider"
const Controls = () => {
- const [mounted, setMounted] = useState(false)
- const { resolvedTheme, setTheme } = useTheme()
- useEffect(() => setMounted(true), [])
- if (!mounted) return null
+ const { theme, setTheme } = useTheme()
const switchThemes = () => {
- if (resolvedTheme === "dark") {
+ if (theme === "dark") {
setTheme("light")
} else {
setTheme("dark")
@@ -26,7 +22,7 @@ const Controls = () => {
h="28px"
pure
onChange={switchThemes}
- value={resolvedTheme}
+ value={theme}
>
diff --git a/client/app/components/header/header.module.css b/client/app/components/header/header.module.css
index 9468452e..04ca1406 100644
--- a/client/app/components/header/header.module.css
+++ b/client/app/components/header/header.module.css
@@ -11,20 +11,37 @@
align-items: center;
}
-.tabs .buttons > button,
-.tabs .buttons > a > button {
+.tabs .buttons button {
border: none;
border-radius: 0;
cursor: pointer;
+ background: var(--bg);
}
-.tabs .active {
- border-bottom: 1px solid var(--darker-gray) !important;
+.tabs .buttons > a:hover,
+.tabs .buttons > button:hover {
+ color: var(--fg);
+ box-shadow: inset 0 -1px 0 var(--fg);
+ transition: box-shadow 0.2s ease-in-out;
+}
+
+.tabs a:active,
+.tabs a:focus,
+.tabs button:active,
+.tabs button:focus {
+ color: var(--darker-gray);
}
.mobile {
position: absolute;
z-index: 1000;
+ display: flex;
+ flex-direction: column;
+}
+
+.mobile button {
+ z-index: 1000;
+ width: 100%;
}
.controls {
diff --git a/client/app/components/header/index.tsx b/client/app/components/header/index.tsx
index 7ca6cfd1..4b6c8683 100644
--- a/client/app/components/header/index.tsx
+++ b/client/app/components/header/index.tsx
@@ -1,15 +1,12 @@
"use client"
import {
- ButtonGroup,
- Button,
Page,
- Spacer,
useBodyScroll,
useMediaQuery
} from "@geist-ui/core/dist"
-import { useCallback, useEffect, useMemo, useState } from "react"
+import { useEffect, useState } from "react"
import styles from "./header.module.css"
import HomeIcon from "@geist-ui/icons/home"
@@ -23,11 +20,12 @@ import YourIcon from "@geist-ui/icons/list"
import MoonIcon from "@geist-ui/icons/moon"
import SettingsIcon from "@geist-ui/icons/settings"
import SunIcon from "@geist-ui/icons/sun"
-import { useTheme } from "next-themes"
// import useUserData from "@lib/hooks/use-user-data"
import Link from "next/link"
import { usePathname } from "next/navigation"
import { signOut } from "next-auth/react"
+import { useTheme } from "@components/theme/ThemeClientContextProvider"
+import Button from "@components/button"
type Tab = {
name: string
@@ -44,8 +42,7 @@ const Header = ({ signedIn = false, isAdmin = false }) => {
const isMobile = useMediaQuery("xs", { match: "down" })
// const { status } = useSession()
// const signedIn = status === "authenticated"
- const { setTheme, resolvedTheme } = useTheme()
-
+ const { setTheme, theme } = useTheme()
useEffect(() => {
setBodyHidden(expanded)
}, [expanded, setBodyHidden])
@@ -68,16 +65,16 @@ const Header = ({ signedIn = false, isAdmin = false }) => {
name: isMobile ? "Change theme" : "",
onClick: function () {
if (typeof window !== "undefined")
- setTheme(resolvedTheme === "light" ? "dark" : "light")
+ setTheme(theme === "light" ? "dark" : "light")
},
- icon: resolvedTheme === "light" ? : ,
+ icon: theme === "light" ? : ,
value: "theme"
}
]
if (isAdmin) {
defaultPages.push({
- name: "admin",
+ name: "Admin",
icon: ,
value: "admin",
href: "/admin"
@@ -87,25 +84,25 @@ const Header = ({ signedIn = false, isAdmin = false }) => {
if (signedIn)
return [
{
- name: "new",
+ name: "New",
icon: ,
value: "new",
href: "/new"
},
{
- name: "yours",
+ name: "Yours",
icon: ,
value: "yours",
href: "/mine"
},
{
- name: "settings",
+ name: "Settings",
icon: ,
value: "settings",
href: "/settings"
},
{
- name: "sign out",
+ name: "Sign Out",
icon: ,
value: "signout",
onClick: () => signOut()
@@ -115,7 +112,7 @@ const Header = ({ signedIn = false, isAdmin = false }) => {
else
return [
{
- name: "home",
+ name: "Home",
icon: ,
value: "home",
href: "/"
@@ -147,26 +144,29 @@ const Header = ({ signedIn = false, isAdmin = false }) => {
}
const getButton = (tab: Tab) => {
- const activeStyle = pathname === tab.href ? styles.active : ""
+ const isActive = pathname === tab.href
+ const activeStyle = isActive ? styles.active : ""
if (tab.onClick) {
return (
)
} else if (tab.href) {
return (
-
-
+
+
)
}
@@ -180,28 +180,14 @@ const Header = ({ signedIn = false, isAdmin = false }) => {
{buttons}