debug-panel , fix sth

This commit is contained in:
tangly1024.com
2023-02-09 12:23:42 +08:00
parent eee01c3085
commit 5f1a13e2a0
7 changed files with 18 additions and 14 deletions

View File

@@ -29,10 +29,9 @@ export function DebugPanel() {
}
function handleChangeDebugTheme() {
switchTheme()
updateThemeConfig(Object.assign({}, ThemeMap[theme].THEME_CONFIG))
updateDebugTheme(theme)
console.log('更换主题', debugTheme)
const newTheme = switchTheme()
updateThemeConfig(Object.assign({}, ThemeMap[newTheme].THEME_CONFIG))
updateDebugTheme(newTheme)
}
function handleUpdateDebugTheme(e) {

View File

@@ -37,7 +37,9 @@ export function GlobalContextProvider({ children }) {
function switchTheme() {
const currentIndex = ALL_THEME.indexOf(theme)
const newIndex = currentIndex < ALL_THEME.length - 1 ? currentIndex + 1 : 0
changeTheme(ALL_THEME[newIndex])
const newTheme = ALL_THEME[newIndex]
changeTheme(newTheme)
return newTheme
}
function changeTheme(theme) {

View File

@@ -236,8 +236,8 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) {
})
}
const categoryOptions = getAllCategories({ allPages, categoryOptions: getCategoryOptions(schema), sliceCount: BLOG.PREVIEW_CATEGORY_COUNT })
const tagOptions = getAllTags({ allPages, sliceCount: BLOG.PREVIEW_TAG_COUNT, tagOptions: getTagOptions(schema) })
const categoryOptions = getAllCategories({ allPages, categoryOptions: getCategoryOptions(schema) })
const tagOptions = getAllTags({ allPages, tagOptions: getTagOptions(schema) })
const siteInfo = getBlogInfo({ collection, block })
const customNav = getCustomNav({ allPages: collectionData.filter(post => post.type === 'Page' && post.status === 'Published') })
const latestPosts = getLatestPosts({ allPages, from, latestPostCount: 5 })

View File

@@ -19,7 +19,7 @@ const Search = props => {
return searchContent.toLowerCase().includes(searchKey.toLowerCase())
})
} else {
filteredPosts = posts
filteredPosts = []
}
const { locale } = useGlobal()

View File

@@ -71,7 +71,7 @@ const LayoutBase = props => {
id="container-inner"
className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'flex-row-reverse' : '') + ' pt-14 w-full mx-auto lg:flex lg:space-x-4 justify-center relative z-10'}
>
<div className="w-full max-w-4xl overflow-x-hidden scroll-hidden">
<div className="w-full max-w-4xl h-full">
{onLoading ? <LoadingCover /> : children}
</div>
<SideRight {...props} slot={rightAreaSlot} />

View File

@@ -7,6 +7,7 @@ import SearchInput from './components/SearchInput'
import Mark from 'mark.js'
import LayoutBase from './LayoutBase'
import { isBrowser } from '@/lib/utils'
import Tags from './components/Tags'
export const LayoutSearch = props => {
const { keyword } = props
@@ -48,6 +49,7 @@ export const LayoutSearch = props => {
<SearchInput {...props} />
</div>
<Tags {...props}/>
{BLOG.POST_LIST_STYLE === 'page' ? <BlogListPage {...props} /> : <BlogListScroll {...props} />}
</LayoutBase>

View File

@@ -1,14 +1,15 @@
import Link from 'next/link'
const Tags = (props) => {
const { tags, tag } = props
const Tags = props => {
const { tagOptions, tag } = props
console.log(props)
const currentTag = tag
if (!tags) return null
if (!tagOptions) return null
return (
<div className="tag-container">
<ul className="flex max-w-full mt-4 overflow-x-auto">
{Object.keys(tags).map(key => {
const tag = tags[key]
{Object.keys(tagOptions).map(key => {
const tag = tagOptions[key]
const selected = tag.name === currentTag
return (
<li