|
1 | 1 | /* eslint-disable @next/next/no-img-element */
|
2 | 2 | import { siteConfig } from '@/lib/config'
|
3 |
| -import CONFIG from '../config' |
4 | 3 | import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
|
5 | 4 | import Link from 'next/link'
|
| 5 | +import CONFIG from '../config' |
6 | 6 |
|
7 | 7 | /**
|
8 | 8 | * 博文列表
|
9 | 9 | * @param {*} param0
|
10 | 10 | * @returns
|
11 | 11 | */
|
12 | 12 | 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> |
36 | 34 | </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'> |
45 | 49 | <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' |
49 | 53 | />
|
50 |
| - </Link> |
| 54 | + </Link> |
51 | 55 | </div>
|
52 | 56 | <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'> |
56 | 58 | {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> |
72 | 70 | </div>
|
| 71 | + </div> |
73 | 72 | </div>
|
74 |
| - }) } |
75 |
| - </div> |
| 73 | + ) |
| 74 | + })} |
| 75 | + </div> |
76 | 76 | </div>
|
77 |
| - </section> |
78 |
| - {/* <!-- ====== Blog Section End --> */} |
| 77 | + </section> |
| 78 | + {/* <!-- ====== Blog Section End --> */} |
79 | 79 | </>
|
| 80 | + ) |
80 | 81 | }
|
0 commit comments