This commit is contained in:
tangly1024.com
2023-11-06 16:28:01 +08:00
parent ecf7825dad
commit a0b481eaca
137 changed files with 326 additions and 383 deletions

View File

@@ -1,6 +1,6 @@
import BLOG from '@/blog.config'
import { useRouter } from 'next/router'
import { useGlobal } from '@/lib/global'
import { siteConfig } from '@/lib/config'
/**
* 加密文章校验组件
@@ -16,7 +16,7 @@ export const ArticleFooter = props => {
return <div className="flex justify-between font-medium text-gray-500 dark:text-gray-400">
<a>
<button
onClick={() => router.push(BLOG.path || '/')}
onClick={() => router.push(siteConfig('path') || '/')}
className="mt-2 cursor-pointer hover:text-black dark:hover:text-gray-100"
>
{locale.POST.BACK}

View File

@@ -1,13 +1,13 @@
import Image from 'next/image'
import BLOG from '@/blog.config'
import TagItem from './TagItem'
import md5 from 'js-md5'
import { siteConfig } from '@/lib/config'
export const ArticleInfo = (props) => {
const { post } = props
const emailHash = md5(BLOG.CONTACT_EMAIL)
const emailHash = md5(siteConfig('CONTACT_EMAIL', '#'))
return <section className="flex-wrap flex mt-2 text-gray--600 dark:text-gray-400 font-light leading-8">
<div>
@@ -19,15 +19,15 @@ export const ArticleInfo = (props) => {
{post?.type !== 'Page' && <>
<nav className="flex mt-7 items-start text-gray-500 dark:text-gray-400">
<div className="flex mb-4">
<a href={BLOG.CONTACT_GITHUB || '#'} className="flex">
<a href={siteConfig('CONTACT_GITHUB') || '#'} className="flex">
<Image
alt={BLOG.author}
alt={siteConfig('AUTHOR')}
width={24}
height={24}
src={`https://gravatar.com/avatar/${emailHash}`}
className="rounded-full"
/>
<p className="ml-2 md:block">{BLOG.author}</p>
<p className="ml-2 md:block">{siteConfig('AUTHOR')}</p>
</a>
<span className="block">&nbsp;/&nbsp;</span>
</div>

View File

@@ -1,5 +1,5 @@
import BLOG from '@/blog.config'
import Link from 'next/link'
import { siteConfig } from '@/lib/config'
/**
* 归档分组文章
@@ -25,7 +25,7 @@ export default function BlogArchiveItem({ archiveTitle, archivePosts }) {
</span>{' '}
&nbsp;
<Link
href={`${BLOG.SUB_PATH}/${post.slug}`}
href={`${siteConfig('SUB_PATH')}/${post.slug}`}
passHref
className="dark:text-gray-400 dark:hover:text-gray-300 overflow-x-hidden hover:underline cursor-pointer text-gray-600">

View File

@@ -1,16 +1,16 @@
import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import { useRouter } from 'next/router'
import Link from 'next/link'
import BlogPost from './BlogPost'
import { useEffect, useRef } from 'react'
import { siteConfig } from '@/lib/config'
export const BlogListPage = props => {
const { page = 1, posts, postCount } = props
const { locale } = useGlobal()
const router = useRouter()
const totalPage = Math.ceil(postCount / BLOG.POSTS_PER_PAGE)
const totalPage = Math.ceil(postCount / parseInt(siteConfig('POSTS_PER_PAGE')))
const currentPage = +page
const showPrev = currentPage > 1

View File

@@ -1,4 +1,3 @@
import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import { useCallback, useEffect, useRef, useState } from 'react'
@@ -13,12 +12,12 @@ export const BlogListScroll = props => {
let hasMore = false
const postsToShow = posts
? Object.assign(posts).slice(0, BLOG.POSTS_PER_PAGE * page)
? Object.assign(posts).slice(0, parseInt(siteConfig('POSTS_PER_PAGE')) * page)
: []
if (posts) {
const totalCount = posts.length
hasMore = page * BLOG.POSTS_PER_PAGE < totalCount
hasMore = page * parseInt(siteConfig('POSTS_PER_PAGE')) < totalCount
}
const handleGetMore = () => {
if (!hasMore) return

View File

@@ -1,4 +1,3 @@
import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'
import { MenuItemDrop } from './MenuItemDrop'
@@ -33,7 +32,7 @@ const MenuList = props => {
const { locale } = useGlobal()
let links = [
{ id: 2, name: locale.NAV.RSS, to: '/feed', show: BLOG.ENABLE_RSS && CONFIG.MENU_RSS, target: '_blank' },
{ id: 2, name: locale.NAV.RSS, to: '/feed', show: siteConfig('ENABLE_RSS') && CONFIG.MENU_RSS, target: '_blank' },
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH },
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE },
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },

View File

@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'
import BLOG from '@/blog.config'
import Link from 'next/link'
import { RecentComments } from '@waline/client'
import { siteConfig } from '@/lib/config'
/**
* @see https://waline.js.org/guide/get-started.html
@@ -13,7 +13,7 @@ const ExampleRecentComments = (props) => {
const [onLoading, changeLoading] = useState(true)
useEffect(() => {
RecentComments({
serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
serverURL: siteConfig('COMMENT_WALINE_SERVER_URL'),
count: 5
}).then(({ comments }) => {
changeLoading(false)

View File

@@ -1,4 +1,3 @@
import BLOG from '@/blog.config'
import Vercel from '@/components/Vercel'
import { siteConfig } from '@/lib/config'
@@ -13,7 +12,7 @@ export const Footer = (props) => {
<div className="my-4 text-sm leading-6">
<div className="flex align-baseline justify-start flex-wrap space-x-6">
<div> © {siteConfig('AUTHOR')} {copyrightDate} </div>
<div>Powered By <a href="https://github.com/tangly1024/NotionNext" className='underline'>NotionNext {BLOG.VERSION}</a></div>
<div>Powered By <a href="https://github.com/tangly1024/NotionNext" className='underline'>NotionNext {siteConfig('VERSION')}</a></div>
<Vercel />
</div>
</div>

View File

@@ -1,4 +1,3 @@
import BLOG from '@/blog.config'
import LazyImage from '@/components/LazyImage'
import Link from 'next/link'
import CONFIG from '../config'
@@ -14,7 +13,7 @@ export default function LogoBar(props) {
const { navBarTitle, siteInfo } = props
return <div className="flex items-center">
<Link href="/" aria-label={BLOG.title}>
<Link href="/" aria-label={siteConfig('title')}>
<div className="h-6 w-6">
{CONFIG.NAV_NOTION_ICON
? <LazyImage src={siteInfo?.icon} className='rounded-full' width={24} height={24} alt={siteConfig('AUTHOR')} />
@@ -23,7 +22,7 @@ export default function LogoBar(props) {
</Link>
{navBarTitle
? (
<Link href="/" aria-label={BLOG.title}>
<Link href="/" aria-label={siteConfig('title')}>
<p className="ml-2 font-medium text-gray-800 dark:text-gray-300 header-name">
{navBarTitle}
</p>
@@ -31,7 +30,7 @@ export default function LogoBar(props) {
)
: (
<p className="ml-2 font-medium text-gray-800 dark:text-gray-300 header-name">
<Link href="/" aria-label={BLOG.title}> {siteConfig('TITLE')}</Link>
<Link href="/" aria-label={siteConfig('title')}> {siteConfig('TITLE')}</Link>
{' '}<span className="font-normal text-sm text-gray-00 dark:text-gray-400">{siteConfig('HOME_BANNER_IMAGE')}</span>
</p>
)}

View File

@@ -3,7 +3,7 @@ import { Dialog, Transition } from '@headlessui/react'
import { usePlogGlobal } from '..'
import { ArrowPath, ChevronLeft, ChevronRight } from '@/components/HeroIcons'
import Link from 'next/link'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import LazyImage from '@/components/LazyImage'
/**
@@ -93,7 +93,7 @@ export default function Modal(props) {
<h2 style={{ textShadow: '0.1em 0.1em 0.2em black' }} className='text-2xl md:text-5xl text-white mb-4 px-2 py-1 rounded-lg'>{modalContent?.title}</h2>
</div>
<Link href={`${BLOG.SUB_PATH}/${modalContent.slug}`}>
<Link href={`${siteConfig('SUB_PATH')}/${modalContent.slug}`}>
<div style={{ textShadow: '0.1em 0.1em 0.2em black' }} className={'line-clamp-3 md:line-clamp-none overflow-hidden cursor-pointer text-gray-50 rounded-lg m-2'}>
{modalContent?.summary}
</div>

View File

@@ -1,6 +1,5 @@
import { useRef, useState } from 'react'
import Link from 'next/link'
import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'
import { SvgIcon } from './SvgIcon'
@@ -19,7 +18,7 @@ const Header = props => {
<div id="sticky-nav"
className={`sticky-nav m-auto w-full h-6 flex flex-row justify-between items-center mb-2 md:mb-12 py-8 glassmorphism ${!fullWidth ? 'max-w-3xl px-4' : 'px-4 md:px-24'
}`} >
<Link href="/" aria-label={BLOG.title} className="flex items-center">
<Link href="/" aria-label={siteConfig('title')} className="flex items-center">
<>
<div className="h-6 w-6">
{/* <SvgIcon/> */}
@@ -49,7 +48,7 @@ const NavBar = props => {
const { locale } = useGlobal()
let links = [
{ id: 2, name: locale.NAV.RSS, to: '/feed', show: BLOG.ENABLE_RSS && CONFIG.MENU_RSS, target: '_blank' },
{ id: 2, name: locale.NAV.RSS, to: '/feed', show: siteConfig('ENABLE_RSS') && CONFIG.MENU_RSS, target: '_blank' },
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH },
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE },
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },

View File

@@ -1,8 +1,9 @@
import BLOG from '@/blog.config'
import Live2D from '@/components/Live2D'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import dynamic from 'next/dynamic'
import { siteConfig } from '@/lib/config'
const ExampleRecentComments = dynamic(() => import('./ExampleRecentComments'))
export const SideBar = (props) => {
@@ -48,7 +49,7 @@ export const SideBar = (props) => {
</div>
</aside>
{BLOG.COMMENT_WALINE_SERVER_URL && BLOG.COMMENT_WALINE_RECENT && <aside className="rounded shadow overflow-hidden mb-6">
{siteConfig('COMMENT_WALINE_SERVER_URL') && siteConfig('COMMENT_WALINE_RECENT') && <aside className="rounded shadow overflow-hidden mb-6">
<h3 className="text-sm bg-gray-100 text-gray-700 dark:bg-hexo-black-gray dark:text-gray-200 py-3 px-4 dark:border-hexo-black-gray border-b">{locale.COMMON.RECENT_COMMENTS}</h3>
<div className="p-4">

View File

@@ -2,7 +2,6 @@ import { Fragment, useRef, useImperativeHandle, useState } from 'react'
import { Dialog, Transition } from '@headlessui/react'
import { Footer } from './Footer'
import SocialButton from './SocialButton'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
/**
@@ -63,7 +62,7 @@ export default function SlideOvers({ children, cRef }) {
>
<div className='max-w-7xl mx-auto space-y-6'>
<h2 className='text-4xl text-gray-200'>关于{siteConfig('AUTHOR')}</h2>
<h2 className='text-2xl text-gray-400'>{BLOG.BIO}</h2>
<h2 className='text-2xl text-gray-400'>{siteConfig('BIO')}</h2>
<h2 className='text-4xl text-gray-200'>联系我</h2>
<SocialButton/>
<Footer/>