diff --git a/themes/magzine/components/Announcement.js b/themes/magzine/components/Announcement.js index 62ab01d0..2a72cea0 100644 --- a/themes/magzine/components/Announcement.js +++ b/themes/magzine/components/Announcement.js @@ -13,11 +13,11 @@ const Announcement = ({ post, className }) => {
+ className='rounded-xl px-2'> {/*
{locale.COMMON.ANNOUNCEMENT}
*/} {post && (
- +
)}
diff --git a/themes/magzine/components/BannerFullWidth.js b/themes/magzine/components/BannerFullWidth.js index fadebaa6..a0cf6dd9 100644 --- a/themes/magzine/components/BannerFullWidth.js +++ b/themes/magzine/components/BannerFullWidth.js @@ -15,11 +15,11 @@ export default function BannerFullWidth() { return null } return ( -
+
diff --git a/themes/magzine/components/CategoryGroup.js b/themes/magzine/components/CategoryGroup.js index 063eb58c..b0592db0 100644 --- a/themes/magzine/components/CategoryGroup.js +++ b/themes/magzine/components/CategoryGroup.js @@ -13,7 +13,7 @@ const CategoryGroup = ({ currentCategory, categoryOptions }) => { } return (
-
{locale.COMMON.CATEGORY}
+
{locale.COMMON.CATEGORY}
{categoryOptions?.map(category => { const selected = currentCategory === category.name diff --git a/themes/magzine/components/Footer.js b/themes/magzine/components/Footer.js index 4d20657d..37d935bf 100644 --- a/themes/magzine/components/Footer.js +++ b/themes/magzine/components/Footer.js @@ -46,7 +46,7 @@ const Footer = ({ title }) => { {MAGZINE_FOOTER_LINKS?.map((group, index) => { return (
-
+
{group.name}
diff --git a/themes/magzine/components/Header.js b/themes/magzine/components/Header.js index a7c4afde..d93317d1 100644 --- a/themes/magzine/components/Header.js +++ b/themes/magzine/components/Header.js @@ -8,6 +8,7 @@ import CONFIG from '../config' import LogoBar from './LogoBar' import { MenuBarMobile } from './MenuBarMobile' import { MenuItemDrop } from './MenuItemDrop' +import { useMagzineGlobal } from '..' /** * 顶部导航栏 + 菜单 @@ -21,6 +22,7 @@ export default function Header(props) { const lastScrollY = useRef(0) // 用于存储上一次的滚动位置 const { locale } = useGlobal() const router = useRouter() + const {searchModal} = useMagzineGlobal() const defaultLinks = [ { @@ -119,14 +121,14 @@ export default function Header(props) { {/* 导航栏菜单内容 */}
+ className='px-4 lg:px-0 flex w-full mx-auto max-w-screen-2xl h-20 transition-all duration-200 items-center justify-between'> {/* 搜索栏 */} {showSearchInput && ( +
{/* 搜索按钮 */}
{ - const { posts, categoryOptions, allNavPages, latestPosts } = props + const { posts, categoryOptions, allNavPages } = props if (!posts || posts.length === 0) { return null } @@ -52,7 +52,7 @@ function groupArticles(categoryOptions, allPosts) { const item = allPosts[i] const categoryName = item?.category ? item?.category : '' // 将 category 转换为字符串 - let existingGroup = groups.find(group => group.category === categoryName) // 搜索同名的最后一个分组 + const existingGroup = groups.find(group => group.category === categoryName) // 搜索同名的最后一个分组 if (existingGroup && existingGroup.category === categoryName) { // 如果分组已存在,并且该分组中的文章数量小于4,添加文章 diff --git a/themes/magzine/components/PostItemCard.js b/themes/magzine/components/PostItemCard.js index 6b4f811a..f25874d3 100644 --- a/themes/magzine/components/PostItemCard.js +++ b/themes/magzine/components/PostItemCard.js @@ -39,7 +39,7 @@ const PostItemCard = ({ post }) => { href={post?.href} passHref className={ - 'cursor-pointer hover:underline leading-tight text-gray-700 dark:text-gray-300 hover:text-gray-500 dark:hover:text-gray-400' + 'text-lg cursor-pointer hover:underline leading-tight text-gray-700 dark:text-gray-300 hover:text-gray-500 dark:hover:text-gray-400' }>

{siteConfig('POST_TITLE_ICON') && ( diff --git a/themes/magzine/components/PostListHorizontal.js b/themes/magzine/components/PostListHorizontal.js index a857af61..5318cf3e 100644 --- a/themes/magzine/components/PostListHorizontal.js +++ b/themes/magzine/components/PostListHorizontal.js @@ -15,7 +15,7 @@ const PostListHorizontal = ({ title, href, posts, hasBg }) => { } return ( -
+
{/* 标题 */}
diff --git a/themes/magzine/components/PostListRecommend.js b/themes/magzine/components/PostListRecommend.js index 84025732..04a4f811 100644 --- a/themes/magzine/components/PostListRecommend.js +++ b/themes/magzine/components/PostListRecommend.js @@ -18,7 +18,7 @@ const PostListRecommend = ({ latestPosts, allNavPages }) => { const title = siteConfig('MAGZINE_RECOMMEND_POST_TITLE') return ( -
+
{/* 标题 */}
diff --git a/themes/magzine/components/PostListSimpleHorizontal.js b/themes/magzine/components/PostListSimpleHorizontal.js index af1ece3a..8568bfe4 100644 --- a/themes/magzine/components/PostListSimpleHorizontal.js +++ b/themes/magzine/components/PostListSimpleHorizontal.js @@ -13,7 +13,7 @@ const PostSimpleListHorizontal = ({ title, href, posts }) => { } return ( -
+
{/* 标题 */}
diff --git a/themes/magzine/index.js b/themes/magzine/index.js index 431f8ca8..139617c9 100644 --- a/themes/magzine/index.js +++ b/themes/magzine/index.js @@ -8,7 +8,7 @@ import { useGlobal } from '@/lib/global' import { isBrowser } from '@/lib/utils' import Link from 'next/link' import { useRouter } from 'next/router' -import { createContext, useContext, useEffect, useState } from 'react' +import { createContext, useContext, useEffect, useRef, useState } from 'react' import Announcement from './components/Announcement' import ArticleInfo from './components/ArticleInfo' import { ArticleLock } from './components/ArticleLock' @@ -44,15 +44,12 @@ export const useMagzineGlobal = () => useContext(ThemeGlobalMagzine) * @constructor */ const LayoutBase = props => { - const { children, notice, showInfoCard = true, post } = props - const { locale } = useGlobal() - const router = useRouter() + const { children, notice } = props const [tocVisible, changeTocVisible] = useState(false) - const { onLoading, fullWidth } = useGlobal() - const [slotRight, setSlotRight] = useState(null) + const searchModal = useRef(null) return ( - + {/* CSS样式 */}