+
+
+
+ {CONFIG.TESTIMONIALS_WORD} diff --git a/themes/matery/components/ArticleRecommend.js b/themes/matery/components/ArticleRecommend.js index cea75055..8fc53a84 100644 --- a/themes/matery/components/ArticleRecommend.js +++ b/themes/matery/components/ArticleRecommend.js @@ -2,6 +2,7 @@ import Link from 'next/link' import CONFIG from '../config' import BLOG from '@/blog.config' import { useGlobal } from '@/lib/global' +import LazyImage from '@/components/LazyImage' /** * 关联推荐文章 @@ -13,53 +14,53 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) { if ( !CONFIG.ARTICLE_RECOMMEND || - !recommendPosts || - recommendPosts.length === 0 + !recommendPosts || + recommendPosts.length === 0 ) { return <>> } return ( ----- - {locale.COMMON.RELATE_POSTS} --- {recommendPosts.map(post => { - const headerImage = post?.pageCoverThumbnail - ? `url("${post.pageCoverThumbnail}")` - : `url("${siteInfo?.pageCover}")` - - return ( - ( - -) } diff --git a/themes/matery/components/BlogPostCard.js b/themes/matery/components/BlogPostCard.js index f30b5948..2a6de771 100644 --- a/themes/matery/components/BlogPostCard.js +++ b/themes/matery/components/BlogPostCard.js @@ -4,6 +4,7 @@ import React from 'react' import TagItemMini from './TagItemMini' import CONFIG from '../config' import TwikooCommentCount from '@/components/TwikooCommentCount' +import LazyImage from '@/components/LazyImage' // import Image from 'next/image' const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { @@ -21,23 +22,21 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { data-aos-delay={delay} data-aos-once="true" data-aos-anchor-placement="top-bottom" - className="w-full mb-4 overflow-auto shadow-md border dark:border-black rounded-xl bg-white dark:bg-hexo-black-gray"> + className="w-full mb-4 overflow-hidden shadow-md border dark:border-black rounded-xl bg-white dark:bg-hexo-black-gray"> {/* 固定高度 ,空白用图片拉升填充 */} --+-+ return ( + ( + +-+- - {post.date?.start_date} --{post.title}-+++++ + {locale.COMMON.RELATE_POSTS}-+ {recommendPosts.map(post => { + const headerImage = post?.pageCoverThumbnail + ? post.pageCoverThumbnail + : siteInfo?.pageCover - ) - ) - })} --+ ++ + ) + ) + })} ++ + +++++ + {post.date?.start_date} ++{post.title}++- +{/* 头部图片 填充卡片 */} {showPageCover && ( -- {/* eslint-disable-next-line @next/next/no-img-element */} -)} diff --git a/themes/matery/components/Hero.js b/themes/matery/components/Hero.js index 6bcd445f..6c94cb1c 100644 --- a/themes/matery/components/Hero.js +++ b/themes/matery/components/Hero.js @@ -4,6 +4,7 @@ import Typed from 'typed.js' import CONFIG from '../config' import { useGlobal } from '@/lib/global' import BLOG from '@/blog.config' +import LazyImage from '@/components/LazyImage' let wrapperTop = 0 @@ -64,8 +65,8 @@ const Hero = props => {+
- {post.title} + {post.title}) diff --git a/themes/matery/components/InfoCard.js b/themes/matery/components/InfoCard.js index 1393211a..0591d3a2 100644 --- a/themes/matery/components/InfoCard.js +++ b/themes/matery/components/InfoCard.js @@ -3,6 +3,7 @@ import { useRouter } from 'next/router' import Card from './Card' import SocialButton from './SocialButton' import MenuGroupCard from './MenuGroupCard' +import LazyImage from '@/components/LazyImage' export function InfoCard (props) { const { className, siteInfo } = props const router = useRouter() @@ -13,8 +14,7 @@ export function InfoCard (props) { router.push('/') }} > - {/* eslint-disable-next-line @next/next/no-img-element */} - +
{BLOG.AUTHOR}{BLOG.BIO}diff --git a/themes/matery/components/LatestPostsGroup.js b/themes/matery/components/LatestPostsGroup.js deleted file mode 100644 index 3cdca279..00000000 --- a/themes/matery/components/LatestPostsGroup.js +++ /dev/null @@ -1,64 +0,0 @@ -import BLOG from '@/blog.config' -import { useGlobal } from '@/lib/global' -import Link from 'next/link' -import { useRouter } from 'next/router' - -/** - * 最新文章列表 - * @param posts 所有文章数据 - * @param sliceCount 截取展示的数量 默认6 - * @constructor - */ -const LatestPostsGroup = ({ latestPosts, siteInfo }) => { - // 获取当前路径 - const currentPath = useRouter().asPath - const { locale } = useGlobal() - - if (!latestPosts) { - return <>> - } - - return <> --- {latestPosts.map(post => { - const selected = currentPath === `${BLOG.SUB_PATH}/${post.slug}` - const headerImage = post?.pageCoverThumbnail - ? `url("${post.pageCoverThumbnail}")` - : `url("${siteInfo?.pageCover}")` - - return ( - ( - - -- - {locale.COMMON.LATEST_POSTS} ---- - ) - ) - })} - > -} -export default LatestPostsGroup diff --git a/themes/matery/components/PostHeader.js b/themes/matery/components/PostHeader.js index dd58bd5f..56f8e541 100644 --- a/themes/matery/components/PostHeader.js +++ b/themes/matery/components/PostHeader.js @@ -1,4 +1,4 @@ -import Image from 'next/image' +import LazyImage from '@/components/LazyImage' /** * 文章背景图 @@ -8,17 +8,11 @@ export default function PostHeader({ post, siteInfo }) { const title = post?.title return (--{post.title}-{post.lastEditedTime}-- {/* eslint-disable-next-line @next/next/no-img-element */} - {/**/} -
- +) } diff --git a/themes/matery/components/SideBar.js b/themes/matery/components/SideBar.js index 4e4d341b..71757bc5 100644 --- a/themes/matery/components/SideBar.js +++ b/themes/matery/components/SideBar.js @@ -1,4 +1,5 @@ import BLOG from '@/blog.config' +import LazyImage from '@/components/LazyImage' import { MenuListSide } from './MenuListSide' /** @@ -15,8 +16,7 @@ const SideBar = (props) => {{title}+ - {/* eslint-disable-next-line @next/next/no-img-element */} -diff --git a/themes/matery/components/SideRight.js b/themes/matery/components/SideRight.js deleted file mode 100644 index e23a1b1e..00000000 --- a/themes/matery/components/SideRight.js +++ /dev/null @@ -1,60 +0,0 @@ -import Card from './Card' -import CategoryGroup from './CategoryGroup' -import LatestPostsGroup from './LatestPostsGroup' -import TagGroups from './TagGroups' -import Catalog from './Catalog' -import { InfoCard } from './InfoCard' -import { AnalyticsCard } from './AnalyticsCard' -import CONFIG from '../config' -import BLOG from '@/blog.config' -import dynamic from 'next/dynamic' - -const HexoRecentComments = dynamic(() => import('./HexoRecentComments')) -/** - * Hexo主题右侧栏 - * @param {*} props - * @returns - */ -export default function SideRight(props) { - const { - post, currentCategory, categories, latestPosts, tags, - currentTag, showCategory, showTag, slot - } = props - - return ( -+
{siteInfo?.title}{siteInfo?.description}-- ) -} diff --git a/themes/medium/components/ArticleInfo.js b/themes/medium/components/ArticleInfo.js index 17fd3ce2..b248a12e 100644 --- a/themes/medium/components/ArticleInfo.js +++ b/themes/medium/components/ArticleInfo.js @@ -1,4 +1,5 @@ import BLOG from '@/blog.config' +import LazyImage from '@/components/LazyImage' import formatDate from '@/lib/formatDate' import Link from 'next/link' @@ -28,8 +29,7 @@ export default function ArticleInfo(props) {- {CONFIG.WIDGET_ANALYTICS && } - - {showCategory && ( - - - )} - {showTag && ( -- 分类 --- - - )} - {CONFIG.WIDGET_LATEST_POSTS && latestPosts && latestPosts.length > 0 &&- - } - - {BLOG.COMMENT_WALINE_SERVER_URL && BLOG.COMMENT_WALINE_RECENT &&- } - - - {post && post.toc && post.toc.length > 1 &&- -- } - {slot} -- - {/* eslint-disable-next-line @next/next/no-img-element */} -+
{BLOG.AUTHOR} diff --git a/themes/medium/components/BlogPostCard.js b/themes/medium/components/BlogPostCard.js index 2fbbede9..273660b0 100644 --- a/themes/medium/components/BlogPostCard.js +++ b/themes/medium/components/BlogPostCard.js @@ -7,6 +7,7 @@ import CONFIG from '../config' import CategoryItem from './CategoryItem' import TagItemMini from './TagItemMini' import TwikooCommentCount from '@/components/TwikooCommentCount' +import LazyImage from '@/components/LazyImage' const BlogPostCard = ({ post, showSummary }) => { const showPreview = CONFIG.POST_LIST_PREVIEW && post.blockMap @@ -30,8 +31,7 @@ const BlogPostCard = ({ post, showSummary }) => { }>{CONFIG.POST_LIST_COVER &&diff --git a/themes/medium/components/InfoCard.js b/themes/medium/components/InfoCard.js index a18408dc..13fe31c8 100644 --- a/themes/medium/components/InfoCard.js +++ b/themes/medium/components/InfoCard.js @@ -1,4 +1,5 @@ import BLOG from '@/blog.config' +import LazyImage from '@/components/LazyImage' import Router from 'next/router' import React from 'react' import SocialButton from './SocialButton' @@ -8,8 +9,7 @@ const InfoCard = (props) => { return- {/* eslint-disable-next-line @next/next/no-img-element */} -} {post.title}+
{ Router.push('/about') }}> - {/* eslint-disable-next-line @next/next/no-img-element */} -+
{BLOG.AUTHOR}{BLOG.BIO}diff --git a/themes/next/components/ArticleDetail.js b/themes/next/components/ArticleDetail.js index fab84eeb..38794f01 100644 --- a/themes/next/components/ArticleDetail.js +++ b/themes/next/components/ArticleDetail.js @@ -12,6 +12,7 @@ import WordCount from './WordCount' import NotionPage from '@/components/NotionPage' import CONFIG from '../config' import NotionIcon from '@/components/NotionIcon' +import LazyImage from '@/components/LazyImage' /** * @@ -39,8 +40,7 @@ export default function ArticleDetail(props) { {/* 头图 */} {CONFIG.POST_HEADER_IMAGE_VISIBLE && post?.type && !post?.type !== 'Page' && post?.pageCover && (- {/* eslint-disable-next-line @next/next/no-img-element */} -)} diff --git a/themes/next/components/Header.js b/themes/next/components/Header.js deleted file mode 100644 index 0a5538a9..00000000 --- a/themes/next/components/Header.js +++ /dev/null @@ -1,115 +0,0 @@ -import { useGlobal } from '@/lib/global' -import { useEffect, useState } from 'react' -import Typed from 'typed.js' -import CONFIG from '../config' - -let wrapperTop = 0 -let windowTop = 0 -let autoScroll = false - -/** - * - * @returns 头图 - */ -export default function Header(props) { - const { siteInfo } = props - const [typed, changeType] = useState() - useEffect(() => { - if (!typed && window && document.getElementById('typed')) { - changeType( - new Typed('#typed', { - strings: CONFIG.HOME_BANNER_Strings, - typeSpeed: 200, - backSpeed: 100, - backDelay: 400, - showCursor: true, - smartBackspace: true - }) - ) - } - }, []) - const { isDarkMode } = useGlobal() - - const autoScrollEnd = () => { - if (autoScroll) { - windowTop = window.scrollY - autoScroll = false - } - } - - const scrollTrigger = () => { - if ( - (window.scrollY > windowTop) & - (window.scrollY < window.innerHeight) && - !autoScroll - ) { - autoScroll = true - window.scrollTo({ top: wrapperTop, behavior: 'smooth' }) - setTimeout(autoScrollEnd, 500) - } - if ( - (window.scrollY < windowTop) & - (window.scrollY < window.innerHeight) && - !autoScroll - ) { - autoScroll = true - window.scrollTo({ top: 0, behavior: 'smooth' }) - setTimeout(autoScrollEnd, 500) - } - windowTop = window.scrollY - - updateTopNav() - } - - const updateTopNav = () => { - if (!isDarkMode) { - const stickyNavElement = document.getElementById('sticky-nav') - if (window.scrollY < window.innerHeight) { - stickyNavElement.classList.add('dark') - } else { - stickyNavElement.classList.remove('dark') - } - } - } - - function updateHeaderHeight() { - setTimeout(() => { - const wrapperElement = document.getElementById('wrapper') - wrapperTop = wrapperElement.offsetTop - }, 500) - } - - useEffect(() => { - updateHeaderHeight() - updateTopNav() - window.addEventListener('scroll', scrollTrigger) - window.addEventListener('resize', updateHeaderHeight) - return () => { - window.removeEventListener('scroll', scrollTrigger) - window.removeEventListener('resize', updateHeaderHeight) - } - }, []) - - return ( -+
- - ) -} diff --git a/themes/next/components/InfoCard.js b/themes/next/components/InfoCard.js index 3adb5825..8dc988f6 100644 --- a/themes/next/components/InfoCard.js +++ b/themes/next/components/InfoCard.js @@ -1,4 +1,5 @@ import BLOG from '@/blog.config' +import LazyImage from '@/components/LazyImage' import Router from 'next/router' import React from 'react' import SocialButton from './SocialButton' @@ -8,8 +9,7 @@ const InfoCard = (props) => { return <>- --{ - window.scrollTo({ top: wrapperTop, behavior: 'smooth' }) - }} - className="cursor-pointer w-full text-center py-4 text-5xl absolute bottom-10 text-white" - > - --} + ) diff --git a/themes/plog/components/LogoBar.js b/themes/plog/components/LogoBar.js index 5f68f396..07539f2f 100644 --- a/themes/plog/components/LogoBar.js +++ b/themes/plog/components/LogoBar.js @@ -1,4 +1,5 @@ import BLOG from '@/blog.config' +import LazyImage from '@/components/LazyImage' import Link from 'next/link' import CONFIG from '../config' import { SvgIcon } from './SvgIcon' @@ -14,10 +15,8 @@ export default function LogoBar(props) { return{ Router.push('/') }}> - {/* eslint-disable-next-line @next/next/no-img-element */} -+
{BLOG.AUTHOR}{BLOG.BIO}diff --git a/themes/next/config.js b/themes/next/config.js index f0dfbb08..16203f5c 100644 --- a/themes/next/config.js +++ b/themes/next/config.js @@ -1,6 +1,6 @@ const CONFIG = { - HOME_BANNER: false, // 首页是否显示大图及标语 [true,false] + HOME_BANNER: true, // 首页是否显示大图及标语 [true,false] HOME_BANNER_Strings: ['Hi,我是一个程序员', 'Hi,我是一个打工人', 'Hi,我是一个干饭人', '欢迎来到我的博客🎉'], // 首页大图标语文字 NAV_TYPE: 'normal', // ['fixed','autoCollapse','normal'] 分别是固定屏幕顶部并始终显示、固定屏幕顶部且滚动时隐藏,不固定屏幕顶部 diff --git a/themes/next/index.js b/themes/next/index.js index 3380b4b1..c59c7279 100644 --- a/themes/next/index.js +++ b/themes/next/index.js @@ -11,7 +11,6 @@ import TopNav from './components/TopNav' import { useGlobal } from '@/lib/global' import { useEffect, useRef, useState } from 'react' import BLOG from '@/blog.config' -import Header from './components/Header' import BlogPostListScroll from './components/BlogPostListScroll' import BlogPostListPage from './components/BlogPostListPage' import StickyBar from './components/StickyBar' @@ -133,7 +132,7 @@ const LayoutBase = (props) => { * @returns */ const LayoutIndex = (props) => { - return} {...props} /> + return } /** diff --git a/themes/nobelium/components/BlogListScroll.js b/themes/nobelium/components/BlogListScroll.js index 157e80e4..d3d91abb 100644 --- a/themes/nobelium/components/BlogListScroll.js +++ b/themes/nobelium/components/BlogListScroll.js @@ -3,6 +3,7 @@ import { useGlobal } from '@/lib/global' import Link from 'next/link' import React from 'react' import throttle from 'lodash.throttle' +import { deepClone } from '@/lib/utils' export const BlogListScroll = props => { const { posts } = props @@ -11,8 +12,8 @@ export const BlogListScroll = props => { const [page, updatePage] = React.useState(1) let hasMore = false - const postsToShow = posts - ? Object.assign(posts).slice(0, BLOG.POSTS_PER_PAGE * page) + const postsToShow = posts && Array.isArray(posts) + ? deepClone(posts).slice(0, BLOG.POSTS_PER_PAGE * page) : [] if (posts) { diff --git a/themes/nobelium/components/Nav.js b/themes/nobelium/components/Nav.js index e3d73a8a..1f12d532 100644 --- a/themes/nobelium/components/Nav.js +++ b/themes/nobelium/components/Nav.js @@ -7,6 +7,7 @@ import { SvgIcon } from './SvgIcon' import { MenuItemDrop } from './MenuItemDrop' import Collapse from '@/components/Collapse' import { MenuItemCollapse } from './MenuItemCollapse' +import LazyImage from '@/components/LazyImage' const Nav = props => { const { navBarTitle, fullWidth, siteInfo } = props @@ -47,8 +48,7 @@ const Nav = props => { {/*diff --git a/themes/plog/components/BlogPost.js b/themes/plog/components/BlogPost.js index 65eacc4c..9ea34720 100644 --- a/themes/plog/components/BlogPost.js +++ b/themes/plog/components/BlogPost.js @@ -2,6 +2,7 @@ import { compressImage } from '@/lib/notion/mapImage' import Link from 'next/link' import { usePlogGlobal } from '..' import { isMobile } from '@/lib/utils' +import LazyImage from '@/components/LazyImage' /** * 博客照片卡牌 @@ -32,8 +33,9 @@ const BlogPost = (props) => { data-aos-once="true" data-aos-anchor-placement="top-bottom" key={post?.id} className='cursor-pointer relative'> - {/* eslint-disable-next-line @next/next/no-img-element */} -*/} {CONFIG.NAV_NOTION_ICON - /* eslint-disable-next-line @next/next/no-img-element */ - ? + ?
: } + +
+ {post?.title}
@@ -42,6 +44,7 @@ const BlogPost = (props) => { {post?.category}{/* 添加onLoad事件处理函数 */} - {/* eslint-disable-next-line @next/next/no-img-element */} -- {/*diff --git a/themes/plog/components/Modal.js b/themes/plog/components/Modal.js index e500c17a..fae47bb2 100644 --- a/themes/plog/components/Modal.js +++ b/themes/plog/components/Modal.js @@ -4,6 +4,7 @@ import { usePlogGlobal } from '..' import { ArrowPath, ChevronLeft, ChevronRight } from '@/components/HeroIcons' import Link from 'next/link' import BLOG from '@/blog.config' +import LazyImage from '@/components/LazyImage' /** * 弹出框 @@ -31,23 +32,23 @@ export default function Modal(props) { // 修改当前显示的遮罩内容 function prev() { + setLoading(true) const index = posts.findIndex(post => post.slug === modalContent.slug) if (index === 0) { setModalContent(posts[posts.length - 1]) } else { setModalContent(posts[index - 1]) } - setLoading(true) } // 下一个 const next = () => { + setLoading(true) const index = posts.findIndex(post => post.slug === modalContent.slug) if (index === posts.length - 1) { setModalContent(posts[0]) } else { setModalContent(posts[index + 1]) } - setLoading(true) } return ( @@ -84,8 +85,7 @@ export default function Modal(props) {*/} {CONFIG.NAV_NOTION_ICON - /* eslint-disable-next-line @next/next/no-img-element */ - ? + ?
: } +
{!loading && (<> diff --git a/themes/plog/components/Nav.js b/themes/plog/components/Nav.js index 36987abb..401f0d49 100644 --- a/themes/plog/components/Nav.js +++ b/themes/plog/components/Nav.js @@ -7,6 +7,7 @@ import { SvgIcon } from './SvgIcon' import { MenuItemDrop } from './MenuItemDrop' import Collapse from '@/components/Collapse' import { MenuItemCollapse } from './MenuItemCollapse' +import LazyImage from '@/components/LazyImage' const Header = props => { const { fullWidth, siteInfo } = props @@ -22,8 +23,7 @@ const Header = props => {{/*diff --git a/themes/simple/components/Header.js b/themes/simple/components/Header.js index 36ff3b44..8d98310d 100644 --- a/themes/simple/components/Header.js +++ b/themes/simple/components/Header.js @@ -1,4 +1,5 @@ import BLOG from '@/blog.config' +import LazyImage from '@/components/LazyImage' import Link from 'next/link' import CONFIG from '../config' import SocialButton from './SocialButton' @@ -17,12 +18,9 @@ export const Header = (props) => {*/} {CONFIG.NAV_NOTION_ICON - /* eslint-disable-next-line @next/next/no-img-element */ - ? + ?
: } {/* 可使用一张单图作为logo */} - {/* eslint-disable-next-line @next/next/no-img-element */} - {/**/}
- {/* eslint-disable-next-line @next/next/no-img-element */} -+