fix dark mode

This commit is contained in:
Clas Wen 2025-01-28 15:13:48 +08:00
parent 4e7a9cc736
commit da0566143e
4 changed files with 12 additions and 8 deletions

View file

@ -1,6 +1,7 @@
import { useState } from "react" import { useState } from "react"
import { Navbar, NavbarBrand, NavbarContent, NavbarItem, NavbarMenuToggle, NavbarMenu, NavbarMenuItem, Link } from "@nextui-org/react" import { Navbar, NavbarBrand, NavbarContent, NavbarItem, NavbarMenuToggle, NavbarMenu, NavbarMenuItem, Link } from "@nextui-org/react"
import { SITE_TITLE } from "../../consts" import { SITE_TITLE } from "../../consts"
import CALogoWhite from "./assets/CA-logo-white.png"
export default function App() { export default function App() {
const [isMenuOpen, setIsMenuOpen] = useState(false) const [isMenuOpen, setIsMenuOpen] = useState(false)
@ -31,10 +32,16 @@ export default function App() {
<img <img
src="https://oss.nbtca.space/CA-logo.svg" src="https://oss.nbtca.space/CA-logo.svg"
alt="" alt=""
className="w-8 aspect-square cursor-pointer" className="w-8 aspect-square cursor-pointer dark:hidden"
onClick={() => window.location.href = "/"} onClick={() => window.location.href = "/"}
/> />
<span className="hidden sm:flex select-none cursor-default text-lg text-[#1d1d1f]"> <img
src={CALogoWhite.src}
alt=""
className="w-8 aspect-square cursor-pointer hidden dark:block"
onClick={() => window.location.href = "/"}
/>
<span className="hidden sm:flex select-none cursor-default text-lg text-[#1d1d1f] dark:text-white">
{SITE_TITLE} {SITE_TITLE}
</span> </span>
</NavbarBrand> </NavbarBrand>

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 KiB

View file

@ -5,7 +5,7 @@ pubDate: 2024-10-13
description: ' ' description: ' '
author: 'zzh0u' author: 'zzh0u'
tags: ["技术","开发","Git"] tags: ["技术","开发","Git"]
theme: 'white' theme: 'dark'
featured: true featured: true
--- ---

View file

@ -1,10 +1,7 @@
import { nextui } from "@nextui-org/react" import { nextui } from "@nextui-org/react"
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
export default { export default {
content: [ content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}", "./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}"],
"./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}",
"./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}",
],
theme: { theme: {
extend: { extend: {
colors: { colors: {
@ -12,6 +9,6 @@ export default {
}, },
}, },
}, },
darkMode: "class", darkMode: ["selector", "body.theme-dark"],
plugins: [nextui()], plugins: [nextui()],
} }