'use client'
import CONFIG from './config'
import TopNav from './components/TopNav'
import AsideLeft from './components/AsideLeft'
import { isBrowser } from '@/lib/utils'
import { useGlobal } from '@/lib/global'
import BlogListPage from './components/BlogListPage'
import BlogListScroll from './components/BlogListScroll'
import BlogArchiveItem from './components/BlogPostArchive'
import ArticleDetail from './components/ArticleDetail'
import ArticleLock from './components/ArticleLock'
import TagItemMini from './components/TagItemMini'
import { useRouter } from 'next/router'
import { createContext, useContext, useEffect } from 'react'
import Link from 'next/link'
import { Transition } from '@headlessui/react'
import dynamic from 'next/dynamic'
import { AdSlot } from '@/components/GoogleAdsense'
import { Style } from './style'
import replaceSearchResult from '@/components/Mark'
import { siteConfig } from '@/lib/config'
import WWAds from '@/components/WWAds'
const Live2D = dynamic(() => import('@/components/Live2D'))
// 主题全局状态
const ThemeGlobalFukasawa = createContext()
export const useFukasawaGlobal = () => useContext(ThemeGlobalFukasawa)
/**
* 基础布局 采用左右两侧布局,移动端使用顶部导航栏
* @param children
* @param layout
* @param tags
* @param meta
* @param post
* @param currentSearch
* @param currentCategory
* @param currentTag
* @param categories
* @returns {JSX.Element}
* @constructor
*/
const LayoutBase = (props) => {
const { children, headerSlot } = props
const leftAreaSlot =
const { onLoading, fullWidth } = useGlobal()
return (
)
}
/**
* 首页
* @param {*} props notion数据
* @returns 首页就是一个博客列表
*/
const LayoutIndex = (props) => {
return
}
/**
* 博客列表
* @param {*} props
*/
const LayoutPostList = (props) => {
return <>
{siteConfig('POST_LIST_STYLE') === 'page' ? : }
>
}
/**
* 文章详情
* @param {*} props
* @returns
*/
const LayoutSlug = (props) => {
const { lock, validPassword } = props
return (
<>
{lock ? : }
>
)
}
/**
* 搜索页
*/
const LayoutSearch = props => {
const { keyword } = props
const router = useRouter()
useEffect(() => {
if (isBrowser) {
replaceSearchResult({
doms: document.getElementById('posts-wrapper'),
search: keyword,
target: {
element: 'span',
className: 'text-red-500 border-b border-dashed'
}
})
}
}, [router])
return
}
/**
* 归档页面
*/
const LayoutArchive = (props) => {
const { archivePosts } = props
return <>
{Object.keys(archivePosts).map(archiveTitle => (
))}
>
}
/**
* 404
* @param {*} props
* @returns
*/
const Layout404 = props => {
return <>404>
}
/**
* 分类列表
* @param {*} props
* @returns
*/
const LayoutCategoryIndex = (props) => {
const { locale } = useGlobal()
const { categoryOptions } = props
return (
<>
{locale.COMMON.CATEGORY}:
{categoryOptions?.map(category => {
return (
{category.name}({category.count})
)
})}
>
)
}
/**
* 标签列表
* @param {*} props
* @returns
*/
const LayoutTagIndex = (props) => {
const { locale } = useGlobal()
const { tagOptions } = props
return <>
>
}
export {
CONFIG as THEME_CONFIG,
LayoutBase,
LayoutIndex,
LayoutSearch,
LayoutArchive,
LayoutSlug,
Layout404,
LayoutPostList,
LayoutCategoryIndex,
LayoutTagIndex
}