1
- import { ArrowRightCircle , GlobeAlt } from '@/components/HeroIcons'
1
+ import { ArrowRightCircle } from '@/components/HeroIcons'
2
2
import LazyImage from '@/components/LazyImage'
3
3
import { siteConfig } from '@/lib/config'
4
4
import Link from 'next/link'
@@ -18,6 +18,10 @@ export function InfoCard(props) {
18
18
const router = useRouter ( )
19
19
// 在文章详情页特殊处理
20
20
const isSlugPage = router . pathname . indexOf ( '/[prefix]' ) === 0
21
+ const url1 = siteConfig ( 'HEO_INFO_CARD_URL1' , null , CONFIG )
22
+ const icon1 = siteConfig ( 'HEO_INFO_CARD_ICON1' , null , CONFIG )
23
+ const url2 = siteConfig ( 'HEO_INFO_CARD_URL2' , null , CONFIG )
24
+ const icon2 = siteConfig ( 'HEO_INFO_CARD_ICON2' , null , CONFIG )
21
25
return (
22
26
< Card className = 'bg-[#4f65f0] dark:bg-yellow-600 text-white flex flex-col w-72 overflow-hidden relative' >
23
27
{ /* 信息卡牌第一行 */ }
@@ -45,25 +49,55 @@ export function InfoCard(props) {
45
49
< div className = 'flex justify-between' >
46
50
< div className = 'flex space-x-3 hover:text-black dark:hover:text-white' >
47
51
{ /* 两个社交按钮 */ }
48
- < div className = 'bg-indigo-400 p-2 rounded-full transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white' >
49
- < Link href = '/about' >
50
- < GlobeAlt className = { 'w-6 h-6' } />
51
- </ Link >
52
- </ div >
53
- < div className = 'bg-indigo-400 p-2 rounded-full w-10 items-center flex justify-center transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white' >
54
- { siteConfig ( 'HEO_INFO_CARD_URL' , null , CONFIG ) && (
55
- < Link href = { siteConfig ( 'HEO_INFO_CARD_URL' , null , CONFIG ) } >
56
- < i className = 'fab fa-github text-xl' />
52
+ { url1 && (
53
+ < div className = 'w-10 text-center bg-indigo-400 p-2 rounded-full transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white' >
54
+ < Link href = { url1 } >
55
+ < i className = { icon1 } />
57
56
</ Link >
58
- ) }
59
- </ div >
57
+ </ div >
58
+ ) }
59
+ { url2 && (
60
+ < div className = 'bg-indigo-400 p-2 rounded-full w-10 items-center flex justify-center transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white' >
61
+ < Link href = { url2 } >
62
+ < i className = { icon2 } />
63
+ </ Link >
64
+ </ div >
65
+ ) }
60
66
</ div >
67
+ { /* 第三个按钮 */ }
61
68
< MoreButton />
62
69
</ div >
63
70
</ Card >
64
71
)
65
72
}
66
73
74
+ /**
75
+ * 了解更多按鈕
76
+ * @returns
77
+ */
78
+ function MoreButton ( ) {
79
+ const url3 = siteConfig ( 'HEO_INFO_CARD_URL3' , null , CONFIG )
80
+ const text3 = siteConfig ( 'HEO_INFO_CARD_TEXT3' , null , CONFIG )
81
+ if ( ! url3 ) {
82
+ return < > </ >
83
+ }
84
+ return (
85
+ < Link href = { url3 } >
86
+ < div
87
+ className = {
88
+ 'group bg-indigo-400 dark:bg-yellow-500 hover:bg-white dark:hover:bg-black hover:text-black dark:hover:text-white flex items-center transition-colors duration-200 py-2 px-3 rounded-full space-x-1'
89
+ } >
90
+ < ArrowRightCircle
91
+ className = {
92
+ 'group-hover:stroke-black dark:group-hover:stroke-white w-6 h-6 transition-all duration-100'
93
+ }
94
+ />
95
+ < div className = 'font-bold' > { text3 } </ div >
96
+ </ div >
97
+ </ Link >
98
+ )
99
+ }
100
+
67
101
/**
68
102
* 欢迎语
69
103
*/
@@ -84,25 +118,3 @@ function GreetingsWords() {
84
118
</ div >
85
119
)
86
120
}
87
-
88
- /**
89
- * 了解更多按鈕
90
- * @returns
91
- */
92
- function MoreButton ( ) {
93
- return (
94
- < Link href = '/about' >
95
- < div
96
- className = {
97
- 'group bg-indigo-400 dark:bg-yellow-500 hover:bg-white dark:hover:bg-black hover:text-black dark:hover:text-white flex items-center transition-colors duration-200 py-2 px-3 rounded-full space-x-1'
98
- } >
99
- < ArrowRightCircle
100
- className = {
101
- 'group-hover:stroke-black dark:group-hover:stroke-white w-6 h-6 transition-all duration-100'
102
- }
103
- />
104
- < div className = 'font-bold' > 了解更多</ div >
105
- </ div >
106
- </ Link >
107
- )
108
- }
0 commit comments