整理修改

This commit is contained in:
tangly1024.com
2023-11-02 14:10:46 +08:00
parent a6cc5a11f3
commit 5ccf8823a6
34 changed files with 101 additions and 80 deletions

View File

@@ -1,9 +1,10 @@
import BLOG from '@/blog.config'
import { useEffect, useState } from 'react'
import Select from './Select'
import { useGlobal } from '@/lib/global'
import { THEMES } from '@/themes/theme'
import { useRouter } from 'next/router'
import { siteConfigMap } from '@/lib/config'
import { getQueryParam } from '@/lib/utils'
/**
*
@@ -13,13 +14,14 @@ const DebugPanel = () => {
const [show, setShow] = useState(false)
const { theme, switchTheme, locale } = useGlobal()
const router = useRouter()
const currentTheme = getQueryParam(router.asPath, 'theme') || theme
const [siteConfig, updateSiteConfig] = useState({})
// 主题下拉框
const themeOptions = THEMES?.map(t => ({ value: t, text: t }))
useEffect(() => {
updateSiteConfig(Object.assign({}, BLOG))
updateSiteConfig(Object.assign({}, siteConfigMap()))
// updateThemeConfig(Object.assign({}, ThemeMap[BLOG.THEME].THEME_CONFIG))
}, [])
@@ -71,7 +73,7 @@ const DebugPanel = () => {
<div className='flex'>
<Select
label={locale.COMMON.THEME_SWITCH}
value={theme}
value={currentTheme}
options={themeOptions}
onChange={handleUpdateDebugTheme}
/>