From 9853929eb6051f359eed2ec9507fd0f3b1756db5 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 4 Jul 2023 15:07:54 +0800 Subject: [PATCH] group theme files - example --- themes/blank/index.js | 438 ------------------ themes/example/Layout404.js | 9 - themes/example/LayoutArchive.js | 47 -- themes/example/LayoutBase.js | 60 --- themes/example/LayoutCategory.js | 12 - themes/example/LayoutCategoryIndex.js | 28 -- themes/example/LayoutIndex.js | 15 - themes/example/LayoutPage.js | 12 - themes/example/LayoutSearch.js | 56 --- themes/example/LayoutSlug.js | 33 -- themes/example/LayoutTag.js | 12 - themes/example/LayoutTagIndex.js | 31 -- themes/example/components/Announcement.js | 2 +- themes/example/components/ArticleInfo.js | 6 +- .../example/components/BlogListGroupByDate.js | 39 ++ themes/example/components/BlogListPage.js | 2 +- themes/example/components/BlogPostCard.js | 14 +- themes/example/components/CategoryItem.js | 20 + themes/example/components/LoadingCover.js | 8 + themes/example/components/SearchInput.js | 4 +- themes/example/components/TagItem.js | 18 + themes/example/index.js | 235 +++++++++- themes/hexo/components/BlogPostCard.js | 4 +- themes/next/components/BlogPostCard.js | 2 +- themes/theme.js | 20 +- 25 files changed, 330 insertions(+), 797 deletions(-) delete mode 100644 themes/blank/index.js delete mode 100644 themes/example/Layout404.js delete mode 100644 themes/example/LayoutArchive.js delete mode 100644 themes/example/LayoutBase.js delete mode 100644 themes/example/LayoutCategory.js delete mode 100644 themes/example/LayoutCategoryIndex.js delete mode 100644 themes/example/LayoutIndex.js delete mode 100644 themes/example/LayoutPage.js delete mode 100644 themes/example/LayoutSearch.js delete mode 100644 themes/example/LayoutSlug.js delete mode 100644 themes/example/LayoutTag.js delete mode 100644 themes/example/LayoutTagIndex.js create mode 100644 themes/example/components/BlogListGroupByDate.js create mode 100644 themes/example/components/CategoryItem.js create mode 100644 themes/example/components/LoadingCover.js create mode 100644 themes/example/components/TagItem.js diff --git a/themes/blank/index.js b/themes/blank/index.js deleted file mode 100644 index 39b402b0..00000000 --- a/themes/blank/index.js +++ /dev/null @@ -1,438 +0,0 @@ -/* eslint-disable */ - -/** - * 这是一个空白主题,方便您用作创建新主题时的模板,从而开发出您自己喜欢的主题 - * 1. 禁用了代码质量检查功能,提高了代码的宽容度;您可以使用标准的html写法 - * 2. 内容大部分是在此文件中写死,notion数据从props参数中传进来 - * 3. 您可在此网站找到更多喜欢的组件 https://www.tailwind-kit.com/ - */ -import BLOG from '@/blog.config' -import DarkModeButton from '@/components/DarkModeButton' -import NotionPage from '@/components/NotionPage' -import Link from 'next/link' -import { useState } from 'react' - -/** - * 这是个配置文件,可以方便在此统一配置信息 - */ -const THEME_CONFIG = { THEME: 'blank' } - -/** - * 布局框架 - * 作为一个基础框架使用,定义了整个主题每个页面必备的顶部导航栏和页脚 - * 其它页面都嵌入到此框架中使用 - * @param {*} props - * @returns - */ -const LayoutBase = (props) => { - const { siteInfo, children } = props - return
- {/* 顶部导航栏 */} - - - {/* 内容 */} -
- {children} -
- - {/* 底部页脚 */} -
-
-} - -/** - * 首页布局 - * @param {*} props - * @returns - */ -const LayoutIndex = (props) => { - const { siteInfo } = props - return ( - - - - - ) -} - -/** - * 文章详情页布局 - * @param {*} props - * @returns - */ -const LayoutSlug = (props) => -
- -
- -
- -// 其他布局暂时留空 -const LayoutSearch = (props) => -const LayoutArchive = (props) => -const Layout404 = (props) => -const LayoutCategory = (props) => -const LayoutCategoryIndex = (props) => -const LayoutPage = (props) => -const LayoutTag = (props) => -const LayoutTagIndex = (props) => - -/** - * 文章列表 - */ -const PostList = (props) => { - const { latestPosts } = props - return
-
-
-

- Lastest articles -

-

- All article are verified by 2 experts and valdiate by the CTO -

-
- -
-
- {latestPosts?.map(post => ( -
- - blog photo -
-

- {post.category} -

-

- {post.title} -

-

- {post.description} -

-
- - {post.tags?.map(t => { - return
- #{t} -
- })} -
-
- -
- ))} - -
-
-} - -/** -* 导航栏 -* @param {*} param0 -* @returns -*/ -const NavBar = ({ siteInfo }) => { - const [showMenu, setShowMenu] = useState(false) - const toggleMenu = () => { - setShowMenu(!showMenu) - } - return
- -
-} - -/** - * 页脚 - * @param {*} param0 - */ -const Footer = ({ siteInfo }) => { - return -} - -/** - * 首版 - * @param {*} param0 -* @returns -*/ -const CTA = ({ siteInfo }) => { - return
-
-
-

- The React Framework for Production -

-

- Next.js gives you the best developer experience with all the features you need for production: hybrid static & server rendering, TypeScript support, smart bundling, route pre-fetching, and more. No config needed. -

-

- BLANK仅作为演示参考主题,便于开发着创建NotionNext主题 -

-
- - Get started - - - Documentation - -
-
-
-
-} -export { - THEME_CONFIG, - LayoutIndex, - LayoutSearch, - LayoutArchive, - LayoutSlug, - Layout404, - LayoutCategory, - LayoutCategoryIndex, - LayoutPage, - LayoutTag, - LayoutTagIndex -} diff --git a/themes/example/Layout404.js b/themes/example/Layout404.js deleted file mode 100644 index c0992ad3..00000000 --- a/themes/example/Layout404.js +++ /dev/null @@ -1,9 +0,0 @@ -import LayoutBase from './LayoutBase' - -export const Layout404 = (props) => { - return - 404 Not found. - -} - -export default Layout404 diff --git a/themes/example/LayoutArchive.js b/themes/example/LayoutArchive.js deleted file mode 100644 index e36a3210..00000000 --- a/themes/example/LayoutArchive.js +++ /dev/null @@ -1,47 +0,0 @@ -import BLOG from '@/blog.config' -import Link from 'next/link' -import LayoutBase from './LayoutBase' - -export const LayoutArchive = props => { - const { archivePosts } = props - - return ( - -
- {Object.keys(archivePosts).map(archiveTitle => ( -
-
- {archiveTitle} -
- -
    - {archivePosts[archiveTitle].map(post => ( -
  • -
    - - {post.date?.start_date} - {' '} -   - - - {post.title} - - -
    -
  • - ))} -
-
- ))} -
-
- ) -} - -export default LayoutArchive diff --git a/themes/example/LayoutBase.js b/themes/example/LayoutBase.js deleted file mode 100644 index 9ca0eb5e..00000000 --- a/themes/example/LayoutBase.js +++ /dev/null @@ -1,60 +0,0 @@ -import CommonHead from '@/components/CommonHead' -import React from 'react' -import { Header } from './components/Header' -import { Nav } from './components/Nav' -import { Footer } from './components/Footer' -import { Title } from './components/Title' -import { SideBar } from './components/SideBar' -import JumpToTopButton from './components/JumpToTopButton' -import BLOG from '@/blog.config' -import { useGlobal } from '@/lib/global' -/** - * 基础布局 采用左右两侧布局,移动端使用顶部导航栏 - - * @returns {JSX.Element} - * @constructor - */ -const LayoutBase = props => { - const { children, meta } = props - const { onLoading } = useGlobal() - - const LoadingCover =
-
- -
-
- - return ( -
- - {/* 顶栏LOGO */} -
- - {/* 菜单 */} -