mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-30 07:26:45 +00:00
主题配置文件Notion化
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
/* eslint-disable */
|
||||
import BlogPostListEmpty from './BlogPostListEmpty'
|
||||
import { useRouter } from 'next/router'
|
||||
import BlogPostItem from './BlogPostItem'
|
||||
import { useNavGlobal } from '@/themes/nav'
|
||||
import CONFIG from '../config'
|
||||
import { deepClone } from '@/lib/utils'
|
||||
import { useEffect, useState, createContext, useContext } from 'react'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 博客列表滚动分页
|
||||
@@ -21,22 +20,22 @@ const BlogPostListAll = (props) => {
|
||||
// const [filteredNavPages, setFilteredNavPages] = useState(allNavPages)
|
||||
const { filteredNavPages, setFilteredNavPages, allNavPages } = useNavGlobal()
|
||||
// const [filteredNavPages] = useState(allNavPages)
|
||||
|
||||
|
||||
// const router = useRouter()
|
||||
// 对自定义分类格式化,方便后续使用分类名称做索引,检索同步图标信息
|
||||
// 目前只支持二级分类
|
||||
let links = customMenu
|
||||
let filterLinks = {}
|
||||
const links = customMenu
|
||||
const filterLinks = {}
|
||||
// for循环遍历数组
|
||||
links?.map((link, i) => {
|
||||
let linkTitle = link.title + ''
|
||||
const linkTitle = link.title + ''
|
||||
// console.log('####### link')
|
||||
// console.log(link)
|
||||
// filterLinks[linkTitle] = link
|
||||
filterLinks[linkTitle] = { title: link.title, icon: link.icon, pageIcon: link.pageIcon }
|
||||
if(link?.subMenus){
|
||||
filterLinks[linkTitle] = { title: link.title, icon: link.icon, pageIcon: link.pageIcon }
|
||||
if (link?.subMenus) {
|
||||
link.subMenus?.map((group, index) => {
|
||||
let subMenuTitle = group?.title + ''
|
||||
const subMenuTitle = group?.title + ''
|
||||
// 自定义分类图标与post的category共用
|
||||
// 判断自定义分类与Post中category同名的项,将icon的值传递给post
|
||||
// filterLinks[subMenuTitle] = group
|
||||
@@ -44,18 +43,17 @@ const BlogPostListAll = (props) => {
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
console.log('####### filterLinks')
|
||||
console.log(filterLinks)
|
||||
|
||||
|
||||
// console.log('####### filterLinks')
|
||||
// console.log(filterLinks)
|
||||
|
||||
let selectedSth = false
|
||||
const selectedSth = false
|
||||
const groupedArray = filteredNavPages?.reduce((groups, item) => {
|
||||
let categoryName = item?.category ? item?.category : '' // 将category转换为字符串
|
||||
let categoryIcon = filterLinks[categoryName]?.icon ? filterLinks[categoryName]?.icon : '' // 将pageIcon转换为字符串
|
||||
const categoryName = item?.category ? item?.category : '' // 将category转换为字符串
|
||||
const categoryIcon = filterLinks[categoryName]?.icon ? filterLinks[categoryName]?.icon : '' // 将pageIcon转换为字符串
|
||||
|
||||
// console.log('####### categoryName')
|
||||
// console.log(categoryName)
|
||||
@@ -64,7 +62,7 @@ const BlogPostListAll = (props) => {
|
||||
|
||||
let existingGroup = null
|
||||
// 开启自动分组排序
|
||||
if (JSON.parse(CONFIG.AUTO_SORT)) {
|
||||
if (JSON.parse(siteConfig('NAV_AUTO_SORT', null, CONFIG))) {
|
||||
existingGroup = groups.find(group => group.category === categoryName) // 搜索同名的最后一个分组
|
||||
} else {
|
||||
existingGroup = groups[groups.length - 1] // 获取最后一个分组
|
||||
@@ -87,7 +85,7 @@ const BlogPostListAll = (props) => {
|
||||
// item.icon = filterLinks[categoryName]?.icon ? filterLinks[categoryName]?.icon : ''
|
||||
// console.log('####### item')
|
||||
// console.log(item)
|
||||
let groupSelected = false
|
||||
const groupSelected = false
|
||||
// for (const post of group?.items) {
|
||||
// if (router.asPath.split('?')[0] === '/' + post.slug) {
|
||||
// groupSelected = true
|
||||
@@ -133,7 +131,6 @@ const BlogPostListAll = (props) => {
|
||||
// filterPosts.push(filterGroup)
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
export default BlogPostListAll
|
||||
|
||||
@@ -16,7 +16,7 @@ export default function LogoBar(props) {
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={siteInfo?.icon?.replaceAll('width=400', 'width=280')}
|
||||
height='44px' alt={siteConfig('AUTHOR') + ' - ' + siteConfig('NEXT_PUBLIC_BIO')} className='md:block transition-all hover:scale-110 duration-150' placeholderSrc='' />
|
||||
{CONFIG.SHOW_TITLE_TEXT && siteConfig('TITLE')}
|
||||
{siteConfig('NAV_SHOW_TITLE_TEXT', null, CONFIG) && siteConfig('TITLE')}
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -14,10 +14,10 @@ export const MenuBarMobile = (props) => {
|
||||
|
||||
let links = [
|
||||
// { name: locale.NAV.INDEX, to: '/' || '/', show: true },
|
||||
{ name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', show: CONFIG.MENU_TAG },
|
||||
{ name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE }
|
||||
// { name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH }
|
||||
{ name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('NAV_MENU_CATEGORY', null, CONFIG) },
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('NAV_MENU_TAG', null, CONFIG) },
|
||||
{ name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('NAV_MENU_ARCHIVE', null, CONFIG) }
|
||||
// { name: locale.NAV.SEARCH, to: '/search', show: siteConfig('MENU_SEARCH', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
Reference in New Issue
Block a user