Skip to content

Commit 542f372

Browse files
authored
Merge pull request tangly1024#2336 from tangly1024/release/4.4.5
Release/4.4.5
2 parents 023fe9e + 3bb83c3 commit 542f372

File tree

2 files changed

+65
-62
lines changed

2 files changed

+65
-62
lines changed

themes/gitbook/components/NavPostList.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ const NavPostList = props => {
6161

6262
// 如果都没有选中默认打开第一个
6363
useEffect(() => {
64-
if (expandedGroups.length === 0) {
65-
setExpandedGroups([0])
66-
}
67-
}, [])
64+
setTimeout(() => {
65+
if (expandedGroups.length === 0) {
66+
setExpandedGroups([0])
67+
}
68+
}, 500)
69+
}, [router])
6870

6971
// 折叠项切换,当折叠或展开数组时会调用
7072
const toggleItem = index => {

themes/starter/components/Blog.js

+59-58
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,81 @@
11
/* eslint-disable @next/next/no-img-element */
22
import { siteConfig } from '@/lib/config'
3-
import CONFIG from '../config'
43
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
54
import Link from 'next/link'
5+
import CONFIG from '../config'
66

77
/**
88
* 博文列表
99
* @param {*} param0
1010
* @returns
1111
*/
1212
export const Blog = ({ posts }) => {
13-
return <>
14-
{/* <!-- ====== Blog Section Start --> */}
15-
<section className="bg-white pb-10 pt-20 dark:bg-dark lg:pb-20 lg:pt-[120px]">
16-
<div className="container mx-auto">
17-
{/* 区块标题文字 */}
18-
<div className="-mx-4 flex flex-wrap justify-center">
19-
<div className="w-full px-4">
20-
<div className="mx-auto mb-[60px] max-w-[485px] text-center">
21-
<span className="mb-2 block text-lg font-semibold text-primary">
22-
{siteConfig('STARTER_BLOG_TITLE', null, CONFIG)}
23-
</span>
24-
<h2
25-
className="mb-4 text-3xl font-bold text-dark dark:text-white sm:text-4xl md:text-[40px] md:leading-[1.2]"
26-
>
27-
{siteConfig('STARTER_BLOG_TEXT_1', null, CONFIG)}
28-
</h2>
29-
<p dangerouslySetInnerHTML={
30-
{ __html: siteConfig('STARTER_BLOG_TEXT_2', null, CONFIG) }
31-
} className="text-base text-body-color dark:text-dark-6">
32-
33-
</p>
34-
</div>
35-
</div>
13+
return (
14+
<>
15+
{/* <!-- ====== Blog Section Start --> */}
16+
<section className='bg-white pb-10 pt-20 dark:bg-dark lg:pb-20 lg:pt-[120px]'>
17+
<div className='container mx-auto'>
18+
{/* 区块标题文字 */}
19+
<div className='-mx-4 flex flex-wrap justify-center'>
20+
<div className='w-full px-4'>
21+
<div className='mx-auto mb-[60px] max-w-[485px] text-center'>
22+
<span className='mb-2 block text-lg font-semibold text-primary'>
23+
{siteConfig('STARTER_BLOG_TITLE', null, CONFIG)}
24+
</span>
25+
<h2 className='mb-4 text-3xl font-bold text-dark dark:text-white sm:text-4xl md:text-[40px] md:leading-[1.2]'>
26+
{siteConfig('STARTER_BLOG_TEXT_1', null, CONFIG)}
27+
</h2>
28+
<p
29+
dangerouslySetInnerHTML={{
30+
__html: siteConfig('STARTER_BLOG_TEXT_2', null, CONFIG)
31+
}}
32+
className='text-base text-body-color dark:text-dark-6'></p>
33+
</div>
3634
</div>
37-
{/* 博客列表 此处优先展示3片文章 */}
38-
<div className="-mx-4 flex flex-wrap">
39-
{posts?.map((item, index) => {
40-
const url = checkContainHttp(item.slug) ? sliceUrlFromHttp(item.slug) : `${siteConfig('SUB_PATH', '')}/${item.slug}`
41-
return <div key={index} className="w-full px-4 md:w-1/2 lg:w-1/3">
42-
<div className="wow fadeInUp group mb-10" data-wow-delay=".1s">
43-
<div className="mb-8 overflow-hidden rounded-[5px]">
44-
<Link href={url} className="block">
35+
</div>
36+
{/* 博客列表 此处优先展示3片文章 */}
37+
<div className='-mx-4 flex flex-wrap'>
38+
{posts?.map((item, index) => {
39+
const url = checkContainHttp(item.slug)
40+
? sliceUrlFromHttp(item.slug)
41+
: `${siteConfig('SUB_PATH', '')}/${item.slug}`
42+
return (
43+
<div key={index} className='w-full px-4 md:w-1/2 lg:w-1/3'>
44+
<div
45+
className='wow fadeInUp group mb-10'
46+
data-wow-delay='.1s'>
47+
<div className='mb-8 overflow-hidden rounded-[5px]'>
48+
<Link href={url} className='block'>
4549
<img
46-
src={item.pageCoverThumbnail}
47-
alt={item.title}
48-
className="w-full transition group-hover:rotate-6 group-hover:scale-125"
50+
src={item.pageCoverThumbnail}
51+
alt={item.title}
52+
className='w-full transition group-hover:rotate-6 group-hover:scale-125'
4953
/>
50-
</Link>
54+
</Link>
5155
</div>
5256
<div>
53-
<span
54-
className="mb-6 inline-block rounded-[5px] bg-primary px-4 py-0.5 text-center text-xs font-medium leading-loose text-white"
55-
>
57+
<span className='mb-6 inline-block rounded-[5px] bg-primary px-4 py-0.5 text-center text-xs font-medium leading-loose text-white'>
5658
{item.publishDay}
57-
</span>
58-
<h3>
59-
<a
60-
61-
className="mb-4 inline-block text-xl font-semibold text-dark hover:text-primary dark:text-white dark:hover:text-primary sm:text-2xl lg:text-xl xl:text-2xl"
62-
>
63-
{item.title}
64-
</a>
65-
</h3>
66-
<p
67-
className="max-w-[370px] text-base text-body-color dark:text-dark-6"
68-
>
69-
{item.summary}
70-
</p>
71-
</div>
59+
</span>
60+
<h3>
61+
<Link
62+
href={url}
63+
className='mb-4 inline-block text-xl font-semibold text-dark hover:text-primary dark:text-white dark:hover:text-primary sm:text-2xl lg:text-xl xl:text-2xl'>
64+
{item.title}
65+
</Link>
66+
</h3>
67+
<p className='max-w-[370px] text-base text-body-color dark:text-dark-6'>
68+
{item.summary}
69+
</p>
7270
</div>
71+
</div>
7372
</div>
74-
}) }
75-
</div>
73+
)
74+
})}
75+
</div>
7676
</div>
77-
</section>
78-
{/* <!-- ====== Blog Section End --> */}
77+
</section>
78+
{/* <!-- ====== Blog Section End --> */}
7979
</>
80+
)
8081
}

0 commit comments

Comments
 (0)