Merge pull request #645 from tangly1024/main

tangly1024.com
This commit is contained in:
tangly1024
2022-12-26 21:58:47 +08:00
committed by GitHub
12 changed files with 87 additions and 53 deletions

View File

@@ -1,2 +1,2 @@
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
NEXT_PUBLIC_VERSION=3.7.0 NEXT_PUBLIC_VERSION=3.7.1

View File

@@ -1,4 +1,5 @@
import { useGlobal } from '@/lib/global' import { useGlobal } from '@/lib/global'
import { ALL_THEME } from '@/themes'
import React from 'react' import React from 'react'
import { Draggable } from './Draggable' import { Draggable } from './Draggable'
/** /**
@@ -6,15 +7,24 @@ import { Draggable } from './Draggable'
* @returns 主题切换 * @returns 主题切换
*/ */
export function ThemeSwitch() { export function ThemeSwitch() {
const { theme, switchTheme } = useGlobal() const { theme, changeTheme } = useGlobal()
const onSelectChange = (e) => {
changeTheme(e.target.value)
}
return (<> return (<>
<Draggable> <Draggable>
<div id="draggableBox" style={{ left: '10px', top: '90vh' }} className="fixed text-white bg-black z-50 rounded-lg shadow-card"> <div id="draggableBox" style={{ left: '10px', top: '90vh' }} className="fixed text-white bg-black z-50 rounded-lg shadow-card">
<div className="p-2 flex items-center"> <div className="p-2 flex items-center">
<i className="fas fa-palette mr-1 cursor-move" /> <i className='fas fa-arrows cursor-move px-2' />
<div className='uppercase font-sans whitespace-nowrap cursor-pointer ' onClick={switchTheme}> {theme}</div> {/* <div className='uppercase font-sans whitespace-nowrap cursor-pointer ' onClick={switchTheme}> {theme}</div> */}
<i className='fas fa-arrows cursor-move pl-2' title='click to change theme' alt='click to change theme' /> <select onChange={onSelectChange} name="cars" className='text-white bg-black uppercase'>
{ALL_THEME.map(t => {
const selected = t === theme
return <option key={t} value={t} selected={selected}>{t}</option>
})}
</select>
</div> </div>
</div> </div>
</Draggable> </Draggable>

View File

@@ -1,6 +1,6 @@
{ {
"name": "notion-next", "name": "notion-next",
"version": "3.7.0", "version": "3.7.1",
"homepage": "https://github.com/tangly1024/NotionNext.git", "homepage": "https://github.com/tangly1024/NotionNext.git",
"license": "MIT", "license": "MIT",
"repository": { "repository": {

View File

@@ -1981,3 +1981,7 @@ pre[class*="language-mermaid"] {
code.language-mermaid { code.language-mermaid {
display:none display:none
} }
.code-toolbar{
@apply w-full;
}

View File

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

View File

@@ -86,7 +86,7 @@ const BlogPostCard = ({ post, showSummary }) => {
{CONFIG_HEXO.POST_LIST_COVER && !showPreview && post?.page_cover && !post.results && ( {CONFIG_HEXO.POST_LIST_COVER && !showPreview && post?.page_cover && !post.results && (
<Link href={`${BLOG.SUB_PATH}/${post.slug}`} passHref> <Link href={`${BLOG.SUB_PATH}/${post.slug}`} passHref>
<div className="flex w-full relative duration-200 rounded-t-xl lg:rounded-r-xl lg:rounded-t-none cursor-pointer transform overflow-hidden"> <div className="flex w-full relative duration-200 rounded-t-xl lg:rounded-r-xl lg:rounded-l-none cursor-pointer transform overflow-hidden">
{/* eslint-disable-next-line @next/next/no-img-element */} {/* eslint-disable-next-line @next/next/no-img-element */}
<img <img
src={post?.page_cover} src={post?.page_cover}

View File

@@ -9,5 +9,5 @@ import * as nobelium from './nobelium'
import * as matery from './matery' import * as matery from './matery'
import * as example from './example' import * as example from './example'
export const ALL_THEME = ['hexo', 'next', 'medium', 'fukasawa', 'nobelium', 'matery', 'example'] export const ALL_THEME = ['hexo', 'matery', 'next', 'medium', 'fukasawa', 'nobelium', 'example']
export { hexo, next, medium, fukasawa, nobelium, matery, example } export { hexo, next, medium, fukasawa, nobelium, matery, example }

View File

@@ -2,14 +2,35 @@ import BlogPostListScroll from './components/BlogPostListScroll'
import BlogPostListPage from './components/BlogPostListPage' import BlogPostListPage from './components/BlogPostListPage'
import LayoutBase from './LayoutBase' import LayoutBase from './LayoutBase'
import BLOG from '@/blog.config' import BLOG from '@/blog.config'
import Link from 'next/link'
import HeaderArticle from './components/HeaderArticle'
export const LayoutCategory = props => { export const LayoutCategory = props => {
const { category } = props const { category, categories } = props
return <LayoutBase {...props}> return <LayoutBase {...props} headerSlot={<HeaderArticle {...props} />} >
<div className="cursor-pointer text-lg px-5 py-1 mb-2 font-light hover:text-indigo-700 dark:hover:text-indigo-400 transform dark:text-white">
<i className="mr-1 far fa-folder-open" /> <div className='inner-wrapper'>
{category}
<div className="drop-shadow-xl -mt-32 rounded-md mx-3 px-5 lg:border lg:rounded-xl lg:px-2 lg:py-4 bg-white dark:bg-hexo-black-gray dark:border-black">
<div className='flex justify-center flex-wrap'>
{categories.map(e => {
const selected = e.name === category
return (
<Link key={e.name} href={`/category/${e.name}`} passHref>
<div className='duration-300 text-md whitespace-nowrap dark:hover:text-white px-5 cursor-pointer py-2 hover:text-indigo-400' >
<i className={`mr-4 fas ${selected ? 'fa-folder-open' : 'fa-folder'}`}/>
{e.name}({e.count})
</div>
</Link>
)
})}
</div>
</div>
{BLOG.POST_LIST_STYLE === 'page' ? <BlogPostListPage {...props} /> : <BlogPostListScroll {...props} />}
</div> </div>
{BLOG.POST_LIST_STYLE === 'page' ? <BlogPostListPage {...props} /> : <BlogPostListScroll {...props} />}
</LayoutBase> </LayoutBase>
} }

View File

@@ -1,35 +1,32 @@
import { useGlobal } from '@/lib/global'
import Link from 'next/link' import Link from 'next/link'
import Card from './components/Card' import HeaderArticle from './components/HeaderArticle'
import LayoutBase from './LayoutBase' import LayoutBase from './LayoutBase'
export const LayoutCategoryIndex = props => { export const LayoutCategoryIndex = props => {
const { categories } = props const { categories } = props
const { locale } = useGlobal()
return ( return (
<LayoutBase {...props}> <LayoutBase {...props} headerSlot={<HeaderArticle {...props} />} >
<Card className="w-full min-h-screen">
<div className="dark:text-gray-200 mb-5 mx-3"> <div className='inner-wrapper'>
<i className="mr-4 fas fa-th" />
{locale.COMMON.CATEGORY}: <div className="drop-shadow-xl -mt-32 rounded-md mx-3 px-5 lg:border lg:rounded-xl lg:px-2 lg:py-4 bg-white dark:bg-hexo-black-gray dark:border-black">
</div>
<div id="category-list" className="duration-200 flex flex-wrap mx-8"> <div className='flex justify-center flex-wrap'>
{categories.map(category => { {categories.map(e => {
return ( return (
<Link key={category.name} href={`/category/${category.name}`} passHref> <Link key={e.name} href={`/category/${e.name}`} passHref>
<div <div className='duration-300 text-md whitespace-nowrap dark:hover:text-white px-5 cursor-pointer py-2 hover:text-indigo-400' >
className={ <i className={'mr-4 fas fa-folder'} />
' duration-300 dark:hover:text-white px-5 cursor-pointer py-2 hover:text-indigo-400' {e.name}({e.count})
} </div>
> </Link>
<i className="mr-4 fas fa-folder" /> )
{category.name}({category.count}) })}
</div>
</div> </div>
</Link>
) </div>
})} </LayoutBase>
</div>
</Card>
</LayoutBase>
) )
} }

View File

@@ -14,9 +14,9 @@ export const LayoutTag = (props) => {
return <LayoutBase {...props} headerSlot={<HeaderArticle {...props} />} > return <LayoutBase {...props} headerSlot={<HeaderArticle {...props} />} >
<div className='inner-wrapper drop-shadow-xl'> <div className='inner-wrapper'>
<div className="-mt-32 rounded-md mx-3 px-5 lg:border lg:rounded-xl lg:px-2 lg:py-4 bg-white dark:bg-hexo-black-gray dark:border-black"> <div className="drop-shadow-xl -mt-32 rounded-md mx-3 px-5 lg:border lg:rounded-xl lg:px-2 lg:py-4 bg-white dark:bg-hexo-black-gray dark:border-black">
<div className="dark:text-gray-200 py-5 text-center text-2xl"> <div className="dark:text-gray-200 py-5 text-center text-2xl">
<i className="fas fa-tags" /> {locale.COMMON.TAGS} <i className="fas fa-tags" /> {locale.COMMON.TAGS}
@@ -33,8 +33,10 @@ export const LayoutTag = (props) => {
})} })}
</div> </div>
</div> </div>
{BLOG.POST_LIST_STYLE === 'page' ? <BlogPostListPage {...props} /> : <BlogPostListScroll {...props} />}
</div> </div>
{BLOG.POST_LIST_STYLE === 'page' ? <BlogPostListPage {...props} /> : <BlogPostListScroll {...props} />}
</LayoutBase> </LayoutBase>
} }

View File

@@ -28,15 +28,14 @@ export const ArticleInfo = (props) => {
passHref passHref
> >
<a className="cursor-pointer whitespace-nowrap"> <a className="cursor-pointer whitespace-nowrap">
<i className='far fa-calendar-minus fa-fw'/>发布日期: {date} <i className='far fa-calendar-minus fa-fw'/> 发布日期: {date}
</a> </a>
</Link> </Link>
<span className='whitespace-nowrap'> <span className='whitespace-nowrap'>
<i className='far fa-calendar-check fa-fw' /> 更新日期: {post.lastEditedTime} <i className='far fa-calendar-check fa-fw' /> 更新日期: {post.lastEditedTime}
</span> </span>
<span className="hidden busuanzi_container_page_pv font-light mr-2"> <span className="hidden busuanzi_container_page_pv font-light mr-2">
<i className='mr-1 fas fa-eye' /> <i className='mr-1 fas fa-eye' /><span className="busuanzi_value_page_pv" />
<span className="busuanzi_value_page_pv" />
</span> </span>
<WordCount /> <WordCount />
</>)} </>)}

View File

@@ -10,14 +10,15 @@ export default function WordCount() {
}) })
return <span id='wordCountWrapper' className='flex gap-3 font-light'> return <span id='wordCountWrapper' className='flex gap-3 font-light'>
<span className='flex whitespace-nowrap'> <span className='flex whitespace-nowrap items-center'>
<i className='mr-1 fas fa-file-word' /> <i className='pl-1 pr-2 fas fa-file-word' />
<span>文章字数</span> <span>文章字数</span>&nbsp;
<span id='wordCount'>0</span></span> <span id='wordCount'>0</span>
<span className='flex whitespace-nowrap'> </span>
<span className='flex whitespace-nowrap items-center'>
<i className='mr-1 fas fa-clock' /> <i className='mr-1 fas fa-clock' />
<span>阅读时长:</span> <span>阅读时长:</span>
<span id='readTime'>0</span> <span id='readTime'>0</span>
</span> </span>
</span> </span>
} }