Skip to content

Commit fb96bc7

Browse files
committed
Magzine主题调整
1 parent f1e3d77 commit fb96bc7

File tree

8 files changed

+126
-221
lines changed

8 files changed

+126
-221
lines changed

themes/magzine/components/ArticleInfo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import TagItemMini from './TagItemMini'
1010
* @returns
1111
*/
1212
export default function ArticleInfo(props) {
13-
const { post, siteInfo } = props
13+
const { post } = props
1414

1515
return (
1616
<>

themes/magzine/components/Footer.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import PoweredBy from '@/components/PoweredBy'
88
import { siteConfig } from '@/lib/config'
99
import { useGlobal } from '@/lib/global'
1010
import Link from 'next/link'
11+
import CONFIG from '../config'
1112
import SocialButton from './SocialButton'
1213

1314
/**
1415
* 网页底脚
1516
*/
1617
const Footer = ({ title }) => {
1718
const { siteInfo } = useGlobal()
18-
const MAGZINE_FOOTER_LINKS = siteConfig('MAGZINE_FOOTER_LINKS', [])
19+
const MAGZINE_FOOTER_LINKS = siteConfig('MAGZINE_FOOTER_LINKS', [], CONFIG)
1920

2021
return (
2122
<footer

themes/magzine/components/Header.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { MenuItemDrop } from './MenuItemDrop'
2020
*/
2121
export default function Header(props) {
2222
const { customNav, customMenu } = props
23-
const [isOpen, changeShow] = useState(false)
23+
const [isOpen, setOpen] = useState(false)
2424
const collapseRef = useRef(null)
2525
const lastScrollY = useRef(0) // 用于存储上一次的滚动位置
2626
const { locale } = useGlobal()
@@ -57,13 +57,13 @@ export default function Header(props) {
5757
let links = defaultLinks.concat(customNav)
5858

5959
const toggleMenuOpen = () => {
60-
changeShow(!isOpen)
60+
setOpen(!isOpen)
6161
}
6262

6363
// 向下滚动时,调整导航条高度
6464
useEffect(() => {
6565
scrollTrigger()
66-
changeShow(false)
66+
setOpen(false)
6767
window.addEventListener('scroll', scrollTrigger)
6868
return () => {
6969
window.removeEventListener('scroll', scrollTrigger)
@@ -216,7 +216,7 @@ export default function Header(props) {
216216
collapseRef={collapseRef}
217217
isOpen={isOpen}
218218
className='md:hidden'>
219-
<div className='bg-white dark:bg-hexo-black-gray pt-1 py-2 lg:hidden '>
219+
<div className='bg-white dark:bg-hexo-black-gray pt-1 py-2'>
220220
<MenuBarMobile
221221
{...props}
222222
onHeightChange={param =>

themes/magzine/components/MenuItemCollapse.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import { useEffect, useState } from 'react'
1010
*/
1111
export const MenuItemCollapse = props => {
1212
const { link } = props
13-
const [show, changeShow] = useState(false)
13+
const [show, setShow] = useState(false)
1414
const hasSubMenu = link?.subMenus?.length > 0
1515

16-
const [isOpen, changeIsOpen] = useState(false)
16+
const [isOpen, setOpen] = useState(false)
1717

1818
const router = useRouter()
1919

@@ -24,16 +24,16 @@ export const MenuItemCollapse = props => {
2424
const selected = router.pathname === link.href || router.asPath === link.href
2525

2626
const toggleShow = () => {
27-
changeShow(!show)
27+
setShow(!show)
2828
}
2929

3030
const toggleOpenSubMenu = () => {
31-
changeIsOpen(!isOpen)
31+
setOpen(!isOpen)
3232
}
3333

3434
// 路由切换时菜单收起
3535
useEffect(() => {
36-
changeIsOpen(false)
36+
setOpen(false)
3737
}, [router])
3838

3939
return (

themes/magzine/components/PostItemCardTop.js

+21-19
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import NotionPage from '@/components/NotionPage'
44
import { siteConfig } from '@/lib/config'
55
import { useGlobal } from '@/lib/global'
66
import Link from 'next/link'
7+
import CONFIG from '../config'
78
import CategoryItem from './CategoryItem'
89
import TagItemMini from './TagItemMini'
910

@@ -13,7 +14,8 @@ import TagItemMini from './TagItemMini'
1314
* @returns
1415
*/
1516
const PostItemCardTop = ({ post, showSummary }) => {
16-
const showPreview = siteConfig('MAGZINE_POST_LIST_PREVIEW') && post?.blockMap
17+
const showPreview =
18+
siteConfig('MAGZINE_POST_LIST_PREVIEW', true, CONFIG) && post?.blockMap
1719
const { locale } = useGlobal()
1820
return (
1921
<div
@@ -24,24 +26,24 @@ const PostItemCardTop = ({ post, showSummary }) => {
2426
// data-aos-anchor-placement='top-bottom'
2527
className='mb-6 max-w-screen-3xl '>
2628
<div className='flex flex-col w-full'>
27-
{siteConfig('MAGZINE_POST_LIST_COVER') && post?.pageCoverThumbnail && (
28-
<Link
29-
href={post?.href || ''}
30-
passHref
31-
className={
32-
'cursor-pointer hover:underline text-4xl leading-tight dark:text-gray-300 dark:hover:text-gray-400'
33-
}>
34-
<div className='w-full max-h-80 object-cover overflow-hidden mb-2'>
35-
<LazyImage
36-
priority
37-
alt={post?.title}
38-
src={post?.pageCoverThumbnail}
39-
style={post?.pageCoverThumbnail ? {} : { height: '0px' }}
40-
className='w-full max-h-80 object-cover hover:scale-125 duration-150'
41-
/>
42-
</div>
43-
</Link>
44-
)}
29+
{siteConfig('MAGZINE_POST_LIST_COVER', true, CONFIG) &&
30+
post?.pageCoverThumbnail && (
31+
<Link
32+
href={post?.href || ''}
33+
passHref
34+
className={
35+
'cursor-pointer hover:underline text-4xl leading-tight dark:text-gray-300 dark:hover:text-gray-400'
36+
}>
37+
<div className='w-full h-80 object-cover overflow-hidden mb-2'>
38+
<LazyImage
39+
priority
40+
alt={post?.title}
41+
src={post?.pageCoverThumbnail}
42+
className='w-full h-80 object-cover hover:scale-125 duration-150'
43+
/>
44+
</div>
45+
</Link>
46+
)}
4547

4648
<div className='flex py-2 mr-2 items-center'>
4749
{siteConfig('MAGZINE_POST_LIST_CATEGORY') && (

themes/magzine/components/PostListRecommend.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { siteConfig } from '@/lib/config'
2+
import CONFIG from '../config'
23
import PostItemCard from './PostItemCard'
34
import PostListEmpty from './PostListEmpty'
45
import Swiper from './Swiper'
@@ -16,7 +17,7 @@ const PostListRecommend = ({ latestPosts, allNavPages }) => {
1617
if (!recommendPosts || recommendPosts.length === 0) {
1718
return <PostListEmpty />
1819
}
19-
const title = siteConfig('MAGZINE_RECOMMEND_POST_TITLE')
20+
const title = siteConfig('MAGZINE_RECOMMEND_POST_TITLE', '', CONFIG)
2021

2122
return (
2223
<div className={`w-full py-10 px-2 bg-[#F6F6F1] dark:bg-black`}>

themes/magzine/components/TopNavBar.js

-109
This file was deleted.

0 commit comments

Comments
 (0)