mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-24 07:26:50 +00:00
async theme
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import BLOG from '@/blog.config'
|
||||
import * as ThemeMap from '@/themes'
|
||||
import { useEffect, useState } from 'react'
|
||||
import Select from './Select'
|
||||
import { ALL_THEME } from '@/themes'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { ALL_THEME } from '@/lib/theme'
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns 调试面板
|
||||
*/
|
||||
const DebugPanel = () => {
|
||||
const [show, setShow] = useState(false)
|
||||
const { theme, changeTheme, switchTheme, locale } = useGlobal()
|
||||
const { changeTheme, switchTheme, locale } = useGlobal()
|
||||
const [siteConfig, updateSiteConfig] = useState({})
|
||||
const [themeConfig, updateThemeConfig] = useState({})
|
||||
// const [themeConfig, updateThemeConfig] = useState({})
|
||||
const [debugTheme, updateDebugTheme] = useState(BLOG.THEME)
|
||||
|
||||
// 主题下拉框
|
||||
@@ -21,7 +21,7 @@ const DebugPanel = () => {
|
||||
useEffect(() => {
|
||||
changeTheme(BLOG.THEME)
|
||||
updateSiteConfig(Object.assign({}, BLOG))
|
||||
updateThemeConfig(Object.assign({}, ThemeMap[BLOG.THEME].THEME_CONFIG))
|
||||
// updateThemeConfig(Object.assign({}, ThemeMap[BLOG.THEME].THEME_CONFIG))
|
||||
}, [])
|
||||
|
||||
function toggleShow() {
|
||||
@@ -30,13 +30,13 @@ const DebugPanel = () => {
|
||||
|
||||
function handleChangeDebugTheme() {
|
||||
const newTheme = switchTheme()
|
||||
updateThemeConfig(Object.assign({}, ThemeMap[newTheme].THEME_CONFIG))
|
||||
// updateThemeConfig(Object.assign({}, ThemeMap[newTheme].THEME_CONFIG))
|
||||
updateDebugTheme(newTheme)
|
||||
}
|
||||
|
||||
function handleUpdateDebugTheme(e) {
|
||||
changeTheme(e)
|
||||
updateThemeConfig(Object.assign({}, ThemeMap[theme].THEME_CONFIG))
|
||||
// updateThemeConfig(Object.assign({}, ThemeMap[theme].THEME_CONFIG))
|
||||
updateDebugTheme(e)
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ const DebugPanel = () => {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
{/* <div>
|
||||
<div className="font-bold w-18 border-b my-2">
|
||||
主题配置{`config_${debugTheme}.js`}:
|
||||
</div>
|
||||
@@ -106,7 +106,7 @@ const DebugPanel = () => {
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div> */}
|
||||
<div className="font-bold w-18 border-b my-2">
|
||||
站点配置[blog.config.js]
|
||||
</div>
|
||||
|
||||
@@ -9,12 +9,10 @@ export default function Live2D() {
|
||||
|
||||
useEffect(() => {
|
||||
if (BLOG.WIDGET_PET) {
|
||||
// setLive2DLoaded(true)
|
||||
// console.log('加载宠物挂件')
|
||||
Promise.all([
|
||||
loadExternalResource('https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/live2d.min.js', 'js')
|
||||
]).then((e) => {
|
||||
if (window?.loadlive2d) {
|
||||
if (typeof window?.loadlive2d !== 'undefined') {
|
||||
// https://github.com/xiazeyu/live2d-widget-models
|
||||
loadlive2d('live2d', BLOG.WIDGET_PET_LINK)
|
||||
}
|
||||
|
||||
10
components/Loading.js
Normal file
10
components/Loading.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 主题文件被加载出之前的占位符
|
||||
* @returns
|
||||
*/
|
||||
const Loading = () => {
|
||||
return <div className="w-screen h-screen flex justify-center items-center">
|
||||
<h1>Loading... <i className='ml-2 fas fa-spinner animate-spin' /></h1>
|
||||
</div>
|
||||
}
|
||||
export default Loading
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { ALL_THEME } from '@/themes'
|
||||
import React from 'react'
|
||||
import { Draggable } from './Draggable'
|
||||
import { ALL_THEME } from '@/lib/theme'
|
||||
/**
|
||||
*
|
||||
* @returns 主题切换
|
||||
|
||||
Reference in New Issue
Block a user