build React.

This commit is contained in:
tangly1024.com
2023-11-06 14:20:43 +08:00
parent 0a6c59ed7b
commit ecf7825dad
117 changed files with 121 additions and 206 deletions

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import BLOG from '@/blog.config'
/**

View File

@@ -2,9 +2,9 @@ import BLOG from '@/blog.config'
import ProductCard from './ProductCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
import { getListByPage } from '@/lib/utils'
import { useEffect, useRef, useState } from 'react'
/**
* 博客列表滚动分页
@@ -15,7 +15,7 @@ import { getListByPage } from '@/lib/utils'
*/
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.POST_LIST_SUMMARY, siteInfo }) => {
const postsPerPage = BLOG.POSTS_PER_PAGE
const [page, updatePage] = React.useState(1)
const [page, updatePage] = useState(1)
const postsToShow = getListByPage(posts, page, postsPerPage)
let hasMore = false
@@ -41,14 +41,14 @@ const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.PO
}
// 监听滚动
React.useEffect(() => {
useEffect(() => {
window.addEventListener('scroll', scrollTrigger)
return () => {
window.removeEventListener('scroll', scrollTrigger)
}
})
const targetRef = React.useRef(null)
const targetRef = useRef(null)
const { locale } = useGlobal()
if (!postsToShow || postsToShow.length === 0) {

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
const CategoryGroup = ({ currentCategory, categories }) => {
if (!categories) {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import { siteConfig } from '@/lib/config'
import Link from 'next/link'

View File

@@ -1,4 +1,4 @@
import React from 'react'
import { useEffect, useState } from 'react'
import BLOG from '@/blog.config'
import Card from '@/themes/hexo/components/Card'
import { useGlobal } from '@/lib/global'
@@ -11,10 +11,10 @@ import { RecentComments } from '@waline/client'
* @returns
*/
const HexoRecentComments = (props) => {
const [comments, updateComments] = React.useState([])
const [comments, updateComments] = useState([])
const { locale } = useGlobal()
const [onLoading, changeLoading] = React.useState(true)
React.useEffect(() => {
const [onLoading, changeLoading] = useState(true)
useEffect(() => {
RecentComments({
serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
count: 5

View File

@@ -1,4 +1,3 @@
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'

View File

@@ -1,5 +1,3 @@
import React from 'react'
import Link from 'next/link'
/**

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
import CONFIG from '../config'
import BLOG from '@/blog.config'
import LazyImage from '@/components/LazyImage'

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { isBrowser } from '@/lib/utils'
/**

View File

@@ -1,5 +1,5 @@
import Catalog from './Catalog'
import React, { useImperativeHandle, useState } from 'react'
import { useImperativeHandle, useState } from 'react'
/**
* 目录抽屉栏

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,6 +1,6 @@
import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import React, { useEffect } from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import throttle from 'lodash.throttle'
import BlogPostCard from './BlogPostCard'
import CONFIG from '../config'
@@ -9,7 +9,7 @@ export const BlogListScroll = props => {
const { posts } = props
const { locale } = useGlobal()
const [page, updatePage] = React.useState(1)
const [page, updatePage] = useState(1)
let hasMore = false
const postsToShow = posts
@@ -25,10 +25,10 @@ export const BlogListScroll = props => {
updatePage(page + 1)
}
const targetRef = React.useRef(null)
const targetRef = useRef(null)
// 监听滚动自动分页加载
const scrollTrigger = React.useCallback(throttle(() => {
const scrollTrigger = useCallback(throttle(() => {
const scrollS = window.scrollY + window.outerHeight
const clientHeight = targetRef ? (targetRef.current ? (targetRef.current.clientHeight) : 0) : 0
if (scrollS > clientHeight + 100) {

View File

@@ -1,4 +1,4 @@
import React from 'react'
import { useEffect, useState } from 'react'
import BLOG from '@/blog.config'
import Link from 'next/link'
import { RecentComments } from '@waline/client'
@@ -9,9 +9,9 @@ import { RecentComments } from '@waline/client'
* @returns
*/
const ExampleRecentComments = (props) => {
const [comments, updateComments] = React.useState([])
const [onLoading, changeLoading] = React.useState(true)
React.useEffect(() => {
const [comments, updateComments] = useState([])
const [onLoading, changeLoading] = useState(true)
useEffect(() => {
RecentComments({
serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
count: 5

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
/**
* 跳转到网页顶部

View File

@@ -1,7 +1,6 @@
import BLOG from '@/blog.config'
import Link from 'next/link'
import TagItemMini from './TagItemMini'
import React from 'react'
import CONFIG_FUKA from '../config'
import LazyImage from '@/components/LazyImage'

View File

@@ -1,5 +1,5 @@
import BLOG from '@/blog.config'
import React from 'react'
import { useEffect, useRef, useState } from 'react'
import BlogCard from './BlogCard'
import BlogPostListEmpty from './BlogListEmpty'
import { useGlobal } from '@/lib/global'
@@ -15,9 +15,9 @@ import { useGlobal } from '@/lib/global'
const BlogListScroll = props => {
const { posts = [], siteInfo } = props
const { locale } = useGlobal()
const targetRef = React.useRef(null)
const targetRef = useRef(null)
const [page, updatePage] = React.useState(1)
const [page, updatePage] = useState(1)
let hasMore = false
const postsToShow = posts
@@ -44,7 +44,7 @@ const BlogListScroll = props => {
})
}
React.useEffect(() => {
useEffect(() => {
window.addEventListener('scroll', scrollTrigger)
return () => {
window.removeEventListener('scroll', scrollTrigger)

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import BLOG from '@/blog.config'
/**

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react'
import { useEffect, useRef, useState } from 'react'
import throttle from 'lodash.throttle'
import { uuidToId } from 'notion-utils'
import { useGlobal } from '@/lib/global'

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
function GroupCategory ({ currentCategory, categories }) {
if (!categories) {

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
import { useGlobal } from '@/lib/global'
const TagItem = ({ tag, selected }) => {

View File

@@ -1,7 +1,6 @@
import BLOG from '@/blog.config'
import Link from 'next/link'
import { useRouter } from 'next/router'
import React from 'react'
const BlogPostCard = ({ post, className }) => {
const router = useRouter()

View File

@@ -1,5 +1,4 @@
import { useGitBookGlobal } from '@/themes/gitbook'
import React from 'react'
import JumpToTopButton from './JumpToTopButton'
export default function BottomMenuBar({ post, className }) {

View File

@@ -1,4 +1,4 @@
import React from 'react'
import CategoryItem from './CategoryItem'
const CategoryGroup = ({ currentCategory, categoryOptions }) => {

View File

@@ -1,4 +1,4 @@
import React from 'react'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
export default function LeftMenuBar () {
return (

View File

@@ -1,5 +1,5 @@
import BlogPostCard from './BlogPostCard'
import React, { useState } from 'react'
import { useState } from 'react'
import Collapse from '@/components/Collapse'
/**

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { isBrowser } from '@/lib/utils'
/**

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import BLOG from '@/blog.config'
import CONFIG from '../config'

View File

@@ -2,7 +2,7 @@ import BLOG from '@/blog.config'
import BlogPostCard from './BlogPostCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import { useGlobal } from '@/lib/global'
import React, { useEffect, useRef, useState } from 'react'
import { useEffect, useRef, useState } from 'react'
import CONFIG from '../config'
import { getListByPage } from '@/lib/utils'

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
const CategoryGroup = ({ currentCategory, categories }) => {
if (!categories) {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import BLOG from '@/blog.config'
import SocialButton from './SocialButton'
import { siteConfig } from '@/lib/config'

View File

@@ -1,9 +1,9 @@
import React from 'react'
import BLOG from '@/blog.config'
import Card from '@/themes/hexo/components/Card'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import { RecentComments } from '@waline/client'
import { useEffect, useState } from 'react'
/**
* @see https://waline.js.org/guide/get-started.html
@@ -11,10 +11,10 @@ import { RecentComments } from '@waline/client'
* @returns
*/
const HexoRecentComments = (props) => {
const [comments, updateComments] = React.useState([])
const [comments, updateComments] = useState([])
const { locale } = useGlobal()
const [onLoading, changeLoading] = React.useState(true)
React.useEffect(() => {
const [onLoading, changeLoading] = useState(true)
useEffect(() => {
RecentComments({
serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
count: 5

View File

@@ -1,4 +1,3 @@
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'

View File

@@ -1,5 +1,3 @@
import React from 'react'
import Link from 'next/link'
/**

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import BLOG from '@/blog.config'
/**

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
import CONFIG from '../config'
import { BlogPostCardInfo } from './BlogPostCardInfo'
import BLOG from '@/blog.config'

View File

@@ -2,7 +2,7 @@ import BLOG from '@/blog.config'
import BlogPostCard from './BlogPostCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import { useGlobal } from '@/lib/global'
import React from 'react'
import { useEffect, useRef, useState } from 'react'
import CONFIG from '../config'
import { getListByPage } from '@/lib/utils'
@@ -15,7 +15,7 @@ import { getListByPage } from '@/lib/utils'
*/
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.POST_LIST_SUMMARY, siteInfo }) => {
const postsPerPage = BLOG.POSTS_PER_PAGE
const [page, updatePage] = React.useState(1)
const [page, updatePage] = useState(1)
const postsToShow = getListByPage(posts, page, postsPerPage)
let hasMore = false
@@ -41,14 +41,14 @@ const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.PO
}
// 监听滚动
React.useEffect(() => {
useEffect(() => {
window.addEventListener('scroll', scrollTrigger)
return () => {
window.removeEventListener('scroll', scrollTrigger)
}
})
const targetRef = React.useRef(null)
const targetRef = useRef(null)
const { locale } = useGlobal()
if (!postsToShow || postsToShow.length === 0) {

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
const CategoryGroup = ({ currentCategory, categories }) => {
if (!categories) {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'

View File

@@ -1,4 +1,4 @@
import React from 'react'
import { useEffect, useState } from 'react'
import BLOG from '@/blog.config'
import Card from '@/themes/hexo/components/Card'
import { useGlobal } from '@/lib/global'
@@ -11,10 +11,10 @@ import { RecentComments } from '@waline/client'
* @returns
*/
const HexoRecentComments = (props) => {
const [comments, updateComments] = React.useState([])
const [comments, updateComments] = useState([])
const { locale } = useGlobal()
const [onLoading, changeLoading] = React.useState(true)
React.useEffect(() => {
const [onLoading, changeLoading] = useState(true)
useEffect(() => {
RecentComments({
serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
count: 5

View File

@@ -1,4 +1,3 @@
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,6 +1,5 @@
import BLOG from '@/blog.config'
import Link from 'next/link'
import React from 'react'
import { siteConfig } from '@/lib/config'
const Logo = props => {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'

View File

@@ -1,5 +1,3 @@
import React from 'react'
import Link from 'next/link'
/**

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { isBrowser } from '@/lib/utils'
/**

View File

@@ -1,5 +1,5 @@
import Catalog from './Catalog'
import React, { useImperativeHandle, useState } from 'react'
import { useImperativeHandle, useState } from 'react'
/**
* 目录抽屉栏

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,6 +1,6 @@
import React from 'react'
import Link from 'next/link'
import BLOG from '@/blog.config'
/**
* 博客归档列表
* @param posts 所有文章

View File

@@ -1,6 +1,5 @@
import BLOG from '@/blog.config'
import Link from 'next/link'
import React from 'react'
import TagItemMini from './TagItemMini'
import CONFIG from '../config'
import TwikooCommentCount from '@/components/TwikooCommentCount'

View File

@@ -2,7 +2,7 @@ import BLOG from '@/blog.config'
import BlogPostCard from './BlogPostCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import { useGlobal } from '@/lib/global'
import React, { useCallback } from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import CONFIG from '../config'
import { getListByPage } from '@/lib/utils'
import throttle from 'lodash.throttle'
@@ -16,9 +16,18 @@ import throttle from 'lodash.throttle'
*/
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.POST_LIST_SUMMARY, siteInfo }) => {
const postsPerPage = BLOG.POSTS_PER_PAGE
const [page, updatePage] = React.useState(1)
const [page, updatePage] = useState(1)
const postsToShow = getListByPage(posts, page, postsPerPage)
// 监听滚动
useEffect(() => {
window.addEventListener('scroll', scrollTrigger)
return () => {
window.removeEventListener('scroll', scrollTrigger)
}
})
const targetRef = useRef(null)
const { locale } = useGlobal()
let hasMore = false
if (posts) {
const totalCount = posts.length
@@ -40,16 +49,6 @@ const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.PO
}
})
}, throttleMs))
// 监听滚动
React.useEffect(() => {
window.addEventListener('scroll', scrollTrigger)
return () => {
window.removeEventListener('scroll', scrollTrigger)
}
})
const targetRef = React.useRef(null)
const { locale } = useGlobal()
if (!postsToShow || postsToShow.length === 0) {
return <BlogPostListEmpty currentSearch={currentSearch} />

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
const CategoryGroup = ({ currentCategory, categories }) => {
if (!categories) {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'

View File

@@ -1,4 +1,4 @@
import React from 'react'
import { useEffect, useState } from 'react'
import BLOG from '@/blog.config'
import Card from '@/themes/hexo/components/Card'
import { useGlobal } from '@/lib/global'
@@ -11,10 +11,10 @@ import { RecentComments } from '@waline/client'
* @returns
*/
const HexoRecentComments = (props) => {
const [comments, updateComments] = React.useState([])
const [comments, updateComments] = useState([])
const { locale } = useGlobal()
const [onLoading, changeLoading] = React.useState(true)
React.useEffect(() => {
const [onLoading, changeLoading] = useState(true)
useEffect(() => {
RecentComments({
serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
count: 5

View File

@@ -1,4 +1,3 @@
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,6 +1,6 @@
import BLOG from '@/blog.config'
import Link from 'next/link'
import React from 'react'
import { siteConfig } from '@/lib/config'
const Logo = props => {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useGlobal } from '@/lib/global'

View File

@@ -1,5 +1,3 @@
import React from 'react'
import Link from 'next/link'
/**

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { isBrowser } from '@/lib/utils'
/**

View File

@@ -1,5 +1,5 @@
import Catalog from './Catalog'
import React, { useImperativeHandle, useState } from 'react'
import { useImperativeHandle, useState } from 'react'
/**
* 目录抽屉栏

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -2,7 +2,6 @@ import BLOG from '@/blog.config'
import NotionPage from '@/components/NotionPage'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import React from 'react'
import CONFIG from '../config'
import CategoryItem from './CategoryItem'
import TagItemMini from './TagItemMini'

View File

@@ -3,7 +3,7 @@ import BlogPostCard from './BlogPostCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import { useGlobal } from '@/lib/global'
import throttle from 'lodash.throttle'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useRouter } from 'next/router'
/**

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
import { useMediumGlobal } from '@/themes/medium'
import JumpToTopButton from './JumpToTopButton'

View File

@@ -1,4 +1,3 @@
import React from 'react'
import CategoryItem from './CategoryItem'
const CategoryGroup = ({ currentCategory, categoryOptions }) => {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import BLOG from '@/blog.config'
import DarkModeButton from '@/components/DarkModeButton'
import { siteConfig } from '@/lib/config'

View File

@@ -1,7 +1,6 @@
import BLOG from '@/blog.config'
import LazyImage from '@/components/LazyImage'
import Router from 'next/router'
import React from 'react'
import SocialButton from './SocialButton'
import { siteConfig } from '@/lib/config'

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
export default function LeftMenuBar () {
return (

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { isBrowser } from '@/lib/utils'
/**

View File

@@ -1,13 +1,11 @@
import BLOG from '@/blog.config'
import Link from 'next/link'
import NotionIcon from './NotionIcon'
import { useRouter } from 'next/router'
import React from 'react'
const BlogPostCard = ({ post, className }) => {
const router = useRouter()
const currentSelected = router.asPath.split('?')[0] === '/' + post.slug
const pageIcon = post.pageIcon.indexOf("amazonaws.com")!=-1 ? post.pageIcon+"&width=88" : post.pageIcon
const pageIcon = post.pageIcon.indexOf('amazonaws.com') !== -1 ? post.pageIcon + '&width=88' : post.pageIcon
return (
<Link href={`${removeHttp(post.slug)}`} target={(checkRemoveHttp(post.slug) ? '_blank' : '_self')} passHref>
<div key={post.id} className={`${className} h-full rounded-lg p-4 dark:bg-neutral-800 cursor-pointer bg-white hover:bg-white rounded-2xl dark:hover:bg-gray-800 ${currentSelected ? 'bg-green-50 text-green-500' : ''}`}>
@@ -23,9 +21,9 @@ const BlogPostCard = ({ post, className }) => {
)
function removeHttp(str) {
// 检查字符串是否包含http
if (str.includes("http")) {
if (str.includes('http')) {
// 如果包含找到http的位置
let index = str.indexOf("http");
const index = str.indexOf('http');
// 返回http之后的部分
return str.slice(index, str.length);
} else {
@@ -35,11 +33,9 @@ const BlogPostCard = ({ post, className }) => {
}
function checkRemoveHttp(str) {
// 检查字符串是否包含http
if (str.includes("http")) {
if (str.includes('http')) {
// 如果包含找到http的位置
let index = str.indexOf("http");
// 包含
return true;
return str.indexOf('http') > -1
} else {
// 不包含
return false;

View File

@@ -1,6 +1,4 @@
import BlogPostCard from './BlogPostCard'
import React, { useState } from 'react'
import NotionIcon from './NotionIcon'
// import Collapse from '@/components/Collapse'
/**
@@ -11,16 +9,11 @@ import NotionIcon from './NotionIcon'
* @constructor
*/
const BlogPostItem = (props) => {
const { group, filterLinks } = props
// const [isOpen, changeIsOpen] = useState(group?.selected)
// const toggleOpenSubMenu = () => {
// changeIsOpen(!isOpen)
// }
const { group } = props
console.log('####### group')
console.log(group)
if (group?.category) {
return <>
<div id={group?.category} className='category text-lg font-normal pt-9 pb-4 first:pt-4 select-none flex justify-between font-sans text-neutral-800 dark:text-neutral-400 p-2' key={group?.category}>

View File

@@ -1,5 +1,4 @@
import { useNavGlobal } from '@/themes/nav'
import React from 'react'
import JumpToTopButton from './JumpToTopButton'
export default function BottomMenuBar({ post, className }) {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import CategoryItem from './CategoryItem'
const CategoryGroup = ({ currentCategory, categoryOptions }) => {

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useImperativeHandle } from 'react'
import { useEffect, useImperativeHandle, useRef } from 'react'
/**
* 折叠面板组件,支持水平折叠、垂直折叠
@@ -7,7 +7,7 @@ import React, { useEffect, useImperativeHandle } from 'react'
*/
const Collapse = props => {
const { collapseRef } = props
const ref = React.useRef(null)
const ref = useRef(null)
const type = props.type || 'vertical'
useImperativeHandle(collapseRef, () => {

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
export default function LeftMenuBar () {
return (

View File

@@ -1,5 +1,5 @@
import BlogPostCard from './BlogPostCard'
import React, { useState } from 'react'
import { useState } from 'react'
import Collapse from '@/components/Collapse'
/**

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { isBrowser } from '@/lib/utils'
/**

View File

@@ -1,6 +1,6 @@
import React from 'react'
import Link from 'next/link'
import BLOG from '@/blog.config'
/**
* 博客归档列表
* @param posts 所有文章

View File

@@ -2,7 +2,6 @@ import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import Image from 'next/image'
import Link from 'next/link'
import React from 'react'
import Card from './Card'
import TagItemMini from './TagItemMini'
import CONFIG from '../config'

View File

@@ -3,7 +3,7 @@ import BlogPostCard from './BlogPostCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import { useGlobal } from '@/lib/global'
import throttle from 'lodash.throttle'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
const CategoryGroup = ({ currentCategory, categories }) => {
if (!categories) return <></>

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
import { useGlobal } from '@/lib/global'
const CategoryList = ({ currentCategory, categoryOptions }) => {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
/**

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import throttle from 'lodash.throttle'
import DarkModeButton from './DarkModeButton'

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
import { siteConfig } from '@/lib/config'
const Logo = props => {

View File

@@ -1,4 +1,4 @@
import React from 'react'
import { useEffect, useState } from 'react'
import BLOG from '@/blog.config'
import Link from 'next/link'
import { RecentComments } from '@waline/client'
@@ -9,9 +9,9 @@ import { RecentComments } from '@waline/client'
* @returns
*/
const NextRecentComments = (props) => {
const [comments, updateComments] = React.useState([])
const [onLoading, changeLoading] = React.useState(true)
React.useEffect(() => {
const [comments, updateComments] = useState([])
const [onLoading, changeLoading] = useState(true)
useEffect(() => {
RecentComments({
serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
count: 5

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { isBrowser } from '@/lib/utils'
/**

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'
@@ -7,10 +6,10 @@ import CONFIG from '../config'
* 展示文章推荐
*/
const RecommendPosts = ({ recommendPosts }) => {
const { locale } = useGlobal()
if (!CONFIG.ARTICLE_RELATE_POSTS || !recommendPosts || recommendPosts.length < 1) {
return <></>
}
const { locale } = useGlobal()
return (
<div className="pt-2 border pl-4 py-2 my-4 dark:text-gray-300 ">

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Image from 'next/image'
/**

View File

@@ -3,7 +3,6 @@ import { MenuList } from './MenuList'
import SearchInput from './SearchInput'
import Toc from './Toc'
import { useGlobal } from '@/lib/global'
import React from 'react'
import Tabs from '@/components/Tabs'
import Logo from './Logo'
import Card from './Card'

View File

@@ -1,6 +1,5 @@
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import React from 'react'
import Card from './Card'
import CategoryGroup from './CategoryGroup'
import TagGroups from './TagGroups'

Some files were not shown because too many files have changed in this diff Show More