mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 23:16:47 +00:00
feature: 提交空主题
This commit is contained in:
6
themes/Empty/Layout404.js
Normal file
6
themes/Empty/Layout404.js
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
export const Layout404 = () => {
|
||||
return <div>
|
||||
404 Not found.
|
||||
</div>
|
||||
}
|
||||
5
themes/Empty/LayoutArchive.js
Normal file
5
themes/Empty/LayoutArchive.js
Normal file
@@ -0,0 +1,5 @@
|
||||
export const LayoutArchive = ({ posts, tags, categories, postCount }) => {
|
||||
return <div>
|
||||
Archive Page
|
||||
</div>
|
||||
}
|
||||
40
themes/Empty/LayoutBase.js
Normal file
40
themes/Empty/LayoutBase.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
|
||||
/**
|
||||
* 基础布局 采用左右两侧布局,移动端使用顶部导航栏
|
||||
* @param children
|
||||
* @param layout
|
||||
* @param tags
|
||||
* @param meta
|
||||
* @param post
|
||||
* @param currentSearch
|
||||
* @param currentCategory
|
||||
* @param currentTag
|
||||
* @param categories
|
||||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = ({
|
||||
children,
|
||||
headerSlot,
|
||||
tags,
|
||||
meta,
|
||||
post,
|
||||
postCount,
|
||||
sideBarSlot,
|
||||
floatSlot,
|
||||
rightAreaSlot,
|
||||
currentSearch,
|
||||
currentCategory,
|
||||
currentTag,
|
||||
categories
|
||||
}) => {
|
||||
return (<>
|
||||
<CommonHead meta={meta} />
|
||||
<main id='wrapper' className='flex justify-center flex-1 pb-12'>
|
||||
{children}
|
||||
</main>
|
||||
</>)
|
||||
}
|
||||
|
||||
export default LayoutBase
|
||||
5
themes/Empty/LayoutCategory.js
Normal file
5
themes/Empty/LayoutCategory.js
Normal file
@@ -0,0 +1,5 @@
|
||||
export const LayoutCategory = ({ tags, posts, category, categories, latestPosts, postCount }) => {
|
||||
return <div>
|
||||
Category - {category}
|
||||
</div>
|
||||
}
|
||||
11
themes/Empty/LayoutCategoryIndex.js
Normal file
11
themes/Empty/LayoutCategoryIndex.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export const LayoutCategoryIndex = ({
|
||||
tags,
|
||||
allPosts,
|
||||
categories,
|
||||
postCount,
|
||||
latestPosts
|
||||
}) => {
|
||||
return <div>
|
||||
CategoryIndex
|
||||
</div>
|
||||
}
|
||||
3
themes/Empty/LayoutIndex.js
Normal file
3
themes/Empty/LayoutIndex.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export const LayoutIndex = ({ posts, tags, meta, categories, postCount, latestPosts }) => {
|
||||
return <div>Index</div>
|
||||
}
|
||||
5
themes/Empty/LayoutPage.js
Normal file
5
themes/Empty/LayoutPage.js
Normal file
@@ -0,0 +1,5 @@
|
||||
export const LayoutPage = ({ page, posts, tags, meta, categories, postCount, latestPosts }) => {
|
||||
return <div>
|
||||
Page - {page}
|
||||
</div>
|
||||
}
|
||||
34
themes/Empty/LayoutSearch.js
Normal file
34
themes/Empty/LayoutSearch.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
export const LayoutSearch = ({
|
||||
posts,
|
||||
tags,
|
||||
categories,
|
||||
postCount
|
||||
}) => {
|
||||
let filteredPosts
|
||||
const searchKey = getSearchKey()
|
||||
if (searchKey) {
|
||||
filteredPosts = posts.filter(post => {
|
||||
const tagContent = post.tags ? post.tags.join(' ') : ''
|
||||
const searchContent = post.title + post.summary + tagContent
|
||||
return searchContent.toLowerCase().includes(searchKey.toLowerCase())
|
||||
})
|
||||
} else {
|
||||
filteredPosts = posts
|
||||
}
|
||||
|
||||
console.log(filteredPosts)
|
||||
|
||||
return <div>
|
||||
Search {searchKey}
|
||||
</div>
|
||||
}
|
||||
|
||||
function getSearchKey () {
|
||||
const router = useRouter()
|
||||
if (router.query && router.query.s) {
|
||||
return router.query.s
|
||||
}
|
||||
return null
|
||||
}
|
||||
21
themes/Empty/LayoutSlug.js
Normal file
21
themes/Empty/LayoutSlug.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'prismjs'
|
||||
import 'prismjs/components/prism-bash'
|
||||
import 'prismjs/components/prism-javascript'
|
||||
import 'prismjs/components/prism-markup'
|
||||
import 'prismjs/components/prism-python'
|
||||
import 'prismjs/components/prism-typescript'
|
||||
|
||||
export const LayoutSlug = ({
|
||||
post,
|
||||
tags,
|
||||
prev,
|
||||
next,
|
||||
recommendPosts,
|
||||
categories,
|
||||
postCount,
|
||||
latestPosts
|
||||
}) => {
|
||||
return <div>
|
||||
Slug
|
||||
</div>
|
||||
}
|
||||
5
themes/Empty/LayoutTag.js
Normal file
5
themes/Empty/LayoutTag.js
Normal file
@@ -0,0 +1,5 @@
|
||||
export const LayoutTag = ({ tags, posts, tag, categories, postCount, latestPosts }) => {
|
||||
return <div>
|
||||
Tag - {tag}
|
||||
</div>
|
||||
}
|
||||
5
themes/Empty/LayoutTagIndex.js
Normal file
5
themes/Empty/LayoutTagIndex.js
Normal file
@@ -0,0 +1,5 @@
|
||||
export const LayoutTagIndex = ({ tags, categories, postCount, latestPosts }) => {
|
||||
return <div>
|
||||
TagIndex
|
||||
</div>
|
||||
}
|
||||
0
themes/Empty/config_empty.js
Normal file
0
themes/Empty/config_empty.js
Normal file
10
themes/Empty/index.js
Normal file
10
themes/Empty/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
export { LayoutIndex } from './LayoutIndex'
|
||||
export { LayoutSearch } from './LayoutSearch'
|
||||
export { LayoutArchive } from './LayoutArchive'
|
||||
export { LayoutSlug } from './LayoutSlug'
|
||||
export { Layout404 } from './Layout404'
|
||||
export { LayoutCategory } from './LayoutCategory'
|
||||
export { LayoutCategoryIndex } from './LayoutCategoryIndex'
|
||||
export { LayoutPage } from './LayoutPage'
|
||||
export { LayoutTag } from './LayoutTag'
|
||||
export { LayoutTagIndex } from './LayoutTagIndex'
|
||||
@@ -1 +1,6 @@
|
||||
/**
|
||||
* 直接将./NEXT 替换成对应的主题路径
|
||||
*/
|
||||
|
||||
export * from './NEXT' // 切换主题
|
||||
// export * from './Empty' // 切换主题
|
||||
|
||||
Reference in New Issue
Block a user