Add title, description, favicon, keywords, author tags
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import React from 'react'
|
||||
import { AddGroupButton } from '@/features/add-group'
|
||||
import { ThemeSwitcher } from '@/features/theme-switch'
|
||||
import { Button } from '@/shadcn/ui/button'
|
||||
@@ -5,13 +6,41 @@ import { useTheme } from 'next-themes'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { FaGithub } from 'react-icons/fa'
|
||||
import cx from 'classnames'
|
||||
|
||||
export function NavBar() {
|
||||
const { resolvedTheme, theme } = useTheme()
|
||||
const { resolvedTheme } = useTheme()
|
||||
const [schemeTheme, setSchemeTheme] = React.useState<string>()
|
||||
const navRef = React.useRef<HTMLDivElement>(null)
|
||||
|
||||
const getSchemeTheme = () => {
|
||||
if (typeof window !== 'undefined') {
|
||||
return window.localStorage.getItem('theme') || document.querySelector('html')!.style.colorScheme
|
||||
} else
|
||||
return 'light'
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
console.log(resolvedTheme, getSchemeTheme())
|
||||
setSchemeTheme(getSchemeTheme())
|
||||
}, [])
|
||||
|
||||
const theme = resolvedTheme || schemeTheme
|
||||
console.log('theme', theme, cx('rounded-lg p-2 w-full flex justify-between', { 'bg-slate-200': theme === 'light', 'bg-slate-900': theme === 'dark' }))
|
||||
|
||||
React.useEffect(() => {
|
||||
if(theme === 'light') {
|
||||
navRef.current?.classList.add('bg-slate-200')
|
||||
navRef.current?.classList.remove('bg-slate-900')
|
||||
} else {
|
||||
navRef.current?.classList.add('bg-slate-900')
|
||||
navRef.current?.classList.remove('bg-slate-200')
|
||||
}
|
||||
}, [theme])
|
||||
|
||||
return (
|
||||
<header className="w-full p-2">
|
||||
<nav className={`rounded-lg p-2 w-full flex justify-between ${(resolvedTheme || theme) === 'light' ? 'bg-slate-200' : ''} ${(resolvedTheme || theme) === 'dark' ? 'bg-slate-900' : ''}`}>
|
||||
<nav className={cx('rounded-lg p-2 w-full flex justify-between', { 'bg-slate-200': theme === 'light', 'bg-slate-900': theme === 'dark' })} ref={navRef}>
|
||||
<ul className="flex gap-2">
|
||||
<NavBarItem url="/ps7">ПС-7</NavBarItem>
|
||||
<NavBarItem url="/pks35k">ПКС-35к</NavBarItem>
|
||||
|
||||
Reference in New Issue
Block a user