mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-03 15:10:19 +00:00
@@ -61,10 +61,12 @@ const NavPostList = props => {
|
|||||||
|
|
||||||
// 如果都没有选中默认打开第一个
|
// 如果都没有选中默认打开第一个
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (expandedGroups.length === 0) {
|
setTimeout(() => {
|
||||||
setExpandedGroups([0])
|
if (expandedGroups.length === 0) {
|
||||||
}
|
setExpandedGroups([0])
|
||||||
}, [])
|
}
|
||||||
|
}, 500)
|
||||||
|
}, [router])
|
||||||
|
|
||||||
// 折叠项切换,当折叠或展开数组时会调用
|
// 折叠项切换,当折叠或展开数组时会调用
|
||||||
const toggleItem = index => {
|
const toggleItem = index => {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/* eslint-disable @next/next/no-img-element */
|
/* eslint-disable @next/next/no-img-element */
|
||||||
import { siteConfig } from '@/lib/config'
|
import { siteConfig } from '@/lib/config'
|
||||||
import CONFIG from '../config'
|
|
||||||
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
|
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
import CONFIG from '../config'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 博文列表
|
* 博文列表
|
||||||
@@ -10,71 +10,72 @@ import Link from 'next/link'
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const Blog = ({ posts }) => {
|
export const Blog = ({ posts }) => {
|
||||||
return <>
|
return (
|
||||||
{/* <!-- ====== Blog Section Start --> */}
|
<>
|
||||||
<section className="bg-white pb-10 pt-20 dark:bg-dark lg:pb-20 lg:pt-[120px]">
|
{/* <!-- ====== Blog Section Start --> */}
|
||||||
<div className="container mx-auto">
|
<section className='bg-white pb-10 pt-20 dark:bg-dark lg:pb-20 lg:pt-[120px]'>
|
||||||
{/* 区块标题文字 */}
|
<div className='container mx-auto'>
|
||||||
<div className="-mx-4 flex flex-wrap justify-center">
|
{/* 区块标题文字 */}
|
||||||
<div className="w-full px-4">
|
<div className='-mx-4 flex flex-wrap justify-center'>
|
||||||
<div className="mx-auto mb-[60px] max-w-[485px] text-center">
|
<div className='w-full px-4'>
|
||||||
<span className="mb-2 block text-lg font-semibold text-primary">
|
<div className='mx-auto mb-[60px] max-w-[485px] text-center'>
|
||||||
{siteConfig('STARTER_BLOG_TITLE', null, CONFIG)}
|
<span className='mb-2 block text-lg font-semibold text-primary'>
|
||||||
</span>
|
{siteConfig('STARTER_BLOG_TITLE', null, CONFIG)}
|
||||||
<h2
|
</span>
|
||||||
className="mb-4 text-3xl font-bold text-dark dark:text-white sm:text-4xl md:text-[40px] md:leading-[1.2]"
|
<h2 className='mb-4 text-3xl font-bold text-dark dark:text-white sm:text-4xl md:text-[40px] md:leading-[1.2]'>
|
||||||
>
|
{siteConfig('STARTER_BLOG_TEXT_1', null, CONFIG)}
|
||||||
{siteConfig('STARTER_BLOG_TEXT_1', null, CONFIG)}
|
</h2>
|
||||||
</h2>
|
<p
|
||||||
<p dangerouslySetInnerHTML={
|
dangerouslySetInnerHTML={{
|
||||||
{ __html: siteConfig('STARTER_BLOG_TEXT_2', null, CONFIG) }
|
__html: siteConfig('STARTER_BLOG_TEXT_2', null, CONFIG)
|
||||||
} className="text-base text-body-color dark:text-dark-6">
|
}}
|
||||||
|
className='text-base text-body-color dark:text-dark-6'></p>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{/* 博客列表 此处优先展示3片文章 */}
|
</div>
|
||||||
<div className="-mx-4 flex flex-wrap">
|
{/* 博客列表 此处优先展示3片文章 */}
|
||||||
{posts?.map((item, index) => {
|
<div className='-mx-4 flex flex-wrap'>
|
||||||
const url = checkContainHttp(item.slug) ? sliceUrlFromHttp(item.slug) : `${siteConfig('SUB_PATH', '')}/${item.slug}`
|
{posts?.map((item, index) => {
|
||||||
return <div key={index} className="w-full px-4 md:w-1/2 lg:w-1/3">
|
const url = checkContainHttp(item.slug)
|
||||||
<div className="wow fadeInUp group mb-10" data-wow-delay=".1s">
|
? sliceUrlFromHttp(item.slug)
|
||||||
<div className="mb-8 overflow-hidden rounded-[5px]">
|
: `${siteConfig('SUB_PATH', '')}/${item.slug}`
|
||||||
<Link href={url} className="block">
|
return (
|
||||||
|
<div key={index} className='w-full px-4 md:w-1/2 lg:w-1/3'>
|
||||||
|
<div
|
||||||
|
className='wow fadeInUp group mb-10'
|
||||||
|
data-wow-delay='.1s'>
|
||||||
|
<div className='mb-8 overflow-hidden rounded-[5px]'>
|
||||||
|
<Link href={url} className='block'>
|
||||||
<img
|
<img
|
||||||
src={item.pageCoverThumbnail}
|
src={item.pageCoverThumbnail}
|
||||||
alt={item.title}
|
alt={item.title}
|
||||||
className="w-full transition group-hover:rotate-6 group-hover:scale-125"
|
className='w-full transition group-hover:rotate-6 group-hover:scale-125'
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span
|
<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'>
|
||||||
className="mb-6 inline-block rounded-[5px] bg-primary px-4 py-0.5 text-center text-xs font-medium leading-loose text-white"
|
|
||||||
>
|
|
||||||
{item.publishDay}
|
{item.publishDay}
|
||||||
</span>
|
</span>
|
||||||
<h3>
|
<h3>
|
||||||
<a
|
<Link
|
||||||
|
href={url}
|
||||||
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"
|
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'>
|
||||||
>
|
{item.title}
|
||||||
{item.title}
|
</Link>
|
||||||
</a>
|
</h3>
|
||||||
</h3>
|
<p className='max-w-[370px] text-base text-body-color dark:text-dark-6'>
|
||||||
<p
|
{item.summary}
|
||||||
className="max-w-[370px] text-base text-body-color dark:text-dark-6"
|
</p>
|
||||||
>
|
|
||||||
{item.summary}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}) }
|
)
|
||||||
</div>
|
})}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{/* <!-- ====== Blog Section End --> */}
|
{/* <!-- ====== Blog Section End --> */}
|
||||||
</>
|
</>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user