optimization

This commit is contained in:
tangly1024.com
2023-02-13 16:19:47 +08:00
parent 8d6e4a80ca
commit 768c259d9d
6 changed files with 23 additions and 12 deletions

View File

@@ -38,7 +38,8 @@ export default {
RECENT_COMMENTS: 'Recent Comments',
DEBUG_OPEN: 'Debug',
DEBUG_CLOSE: 'Close',
THEME_SWITCH: 'Theme Switch'
THEME_SWITCH: 'Theme Switch',
ANNOUNCEMENT: 'Announcement'
},
PAGINATION: {
PREV: 'Prev',

View File

@@ -40,7 +40,8 @@ export default {
RECENT_COMMENTS: '最新评论',
DEBUG_OPEN: '开启调试',
DEBUG_CLOSE: '关闭调试',
THEME_SWITCH: '切换主题'
THEME_SWITCH: '切换主题',
ANNOUNCEMENT: '公告'
},
PAGINATION: {
PREV: '上一页',

View File

@@ -1,16 +1,18 @@
import { useGlobal } from '@/lib/global'
import dynamic from 'next/dynamic'
const NotionPage = dynamic(() => import('@/components/NotionPage'))
const Announcement = ({ post, className }) => {
const { locale } = useGlobal()
if (!post) {
return <></>
}
return <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">
<i className="mr-2 fas fa-bullhorn" />
公告</h3>
<i className="mr-2 fas fa-bullhorn" />{locale.COMMON.ANNOUNCEMENT}
</h3>
{post && (<div id="announcement-content">
<NotionPage post={post} className='text-center ' />

View File

@@ -1,12 +1,12 @@
import { useGlobal } from '@/lib/global'
import dynamic from 'next/dynamic'
const NotionPage = dynamic(() => import('@/components/NotionPage'))
const Announcement = ({ post, className }) => {
if (!post) {
return <></>
}
return <div
const { locale } = useGlobal()
if (post?.blockMap) {
return <div
data-aos="fade-up"
data-aos-duration="600"
data-aos-easing="ease-in-out"
@@ -14,11 +14,14 @@ const Announcement = ({ post, className }) => {
data-aos-anchor-placement="top-bottom"
className={className}>
<section id='announcement-wrapper' className="hover:shadow-md dark:text-gray-300 border dark:border-black rounded-xl px-2 py-4 bg-white dark:bg-hexo-black-gray">
<div><i className='mr-2 fas fa-bullhorn' />公告</div>
<div><i className='mr-2 fas fa-bullhorn' />{locale.COMMON.ANNOUNCEMENT}</div>
{post && (<div id="announcement-content">
<NotionPage post={post} className='text-center ' />
</div>)}
</section>
</div>
} else {
return <></>
}
}
export default Announcement

View File

@@ -9,6 +9,7 @@ import CONFIG_HEXO from '../config_hexo'
import BLOG from '@/blog.config'
import dynamic from 'next/dynamic'
import Announcement from './Announcement'
import { useGlobal } from '@/lib/global'
const HexoRecentComments = dynamic(() => import('./HexoRecentComments'))
/**
@@ -21,6 +22,8 @@ export default function SideRight(props) {
post, currentCategory, categories, latestPosts, tags,
currentTag, showCategory, showTag, slot, notice
} = props
const { locale } = useGlobal()
return (
<div className={'space-y-4 lg:w-80 lg:pt-0 px-2 pt-4'}>
<InfoCard {...props} />
@@ -29,7 +32,7 @@ export default function SideRight(props) {
{showCategory && (
<Card>
<div className='ml-2 mb-1 '>
<i className='fas fa-th' /> 分类
<i className='fas fa-th' /> {locale.COMMON.CATEGORY}
</div>
<CategoryGroup
currentCategory={currentCategory}

View File

@@ -1,16 +1,17 @@
import { useGlobal } from '@/lib/global'
import dynamic from 'next/dynamic'
const NotionPage = dynamic(() => import('@/components/NotionPage'))
const Announcement = ({ post, className }) => {
const { locale } = useGlobal()
if (!post) {
return <></>
}
return <>
<div className="text-sm pb-1 px-2 flex flex-nowrap justify-between">
<div className="font-light text-gray-600 dark:text-gray-200">
<i className="mr-2 fas fa-bullhorn" />
公告
<i className="mr-2 fas fa-bullhorn" />{locale.COMMON.ANNOUNCEMENT}
</div>
</div>
{post && (<div id="announcement-content">