1
- import { siteConfig } from '@/lib/config'
2
1
import { ArrowRightCircle , GlobeAlt } from '@/components/HeroIcons'
3
2
import LazyImage from '@/components/LazyImage'
3
+ import { siteConfig } from '@/lib/config'
4
4
import Link from 'next/link'
5
5
import { useRouter } from 'next/router'
6
6
import { useState } from 'react'
@@ -19,41 +19,48 @@ export function InfoCard(props) {
19
19
// 在文章详情页特殊处理
20
20
const isSlugPage = router . pathname . indexOf ( '/[prefix]' ) === 0
21
21
return (
22
- < Card className = 'bg-[#4f65f0] dark:bg-yellow-600 text-white flex flex-col w-72 overflow-hidden relative' >
23
- { /* 信息卡牌第一行 */ }
24
- < div className = 'flex justify-between' >
25
- { /* 问候语 */ }
26
- < GreetingsWords />
27
- < div className = { `${ isSlugPage ? 'absolute right-0 -mt-8 -mr-6 hover:opacity-0 hover:scale-150 blur' : 'cursor-pointer' } justify-center items-center flex dark:text-gray-100 transform transitaion-all duration-200` } >
28
- < LazyImage src = { siteInfo ?. icon } className = 'rounded-full' width = { isSlugPage ? 100 : 28 } alt = { siteConfig ( 'AUTHOR' ) } />
29
- </ div >
30
- </ div >
22
+ < Card className = 'bg-[#4f65f0] dark:bg-yellow-600 text-white flex flex-col w-72 overflow-hidden relative' >
23
+ { /* 信息卡牌第一行 */ }
24
+ < div className = 'flex justify-between' >
25
+ { /* 问候语 */ }
26
+ < GreetingsWords />
27
+ < div
28
+ className = { `${ isSlugPage ? 'absolute right-0 -mt-8 -mr-6 hover:opacity-0 hover:scale-150 blur' : 'cursor-pointer' } justify-center items-center flex dark:text-gray-100 transform transitaion-all duration-200` } >
29
+ < LazyImage
30
+ src = { siteInfo ?. icon }
31
+ className = 'rounded-full'
32
+ width = { isSlugPage ? 100 : 28 }
33
+ alt = { siteConfig ( 'AUTHOR' ) }
34
+ />
35
+ </ div >
36
+ </ div >
31
37
32
- < h2 className = 'text-3xl font-extrabold mt-3' >
33
- { siteConfig ( 'AUTHOR' ) }
34
- </ h2 >
38
+ < h2 className = 'text-3xl font-extrabold mt-3' > { siteConfig ( 'AUTHOR' ) } </ h2 >
35
39
36
- { /* 公告栏 */ }
37
- < div >
38
- < Announcement post = { notice } style = { { color : 'white !important' } } />
39
- </ div >
40
+ { /* 公告栏 */ }
41
+ < div >
42
+ < Announcement post = { notice } style = { { color : 'white !important' } } />
43
+ </ div >
40
44
41
- < div className = 'flex justify-between' >
42
- < div className = 'flex space-x-3 hover:text-black dark:hover:text-white' >
43
- { /* 两个社交按钮 */ }
44
- < div className = 'bg-indigo-400 p-2 rounded-full transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white' >
45
- < Link href = '/about' > < GlobeAlt className = { 'w-6 h-6' } /> </ Link >
46
- </ div >
47
- < 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' >
48
- { siteConfig ( 'HEO_INFO_CARD_URL' , null , CONFIG ) && < Link href = { siteConfig ( 'HEO_INFO_CARD_URL' , null , CONFIG ) } >
49
- < i className = 'fab fa-github text-xl' />
50
- </ Link >
51
- }
52
- </ div >
53
- </ div >
54
- < MoreButton />
55
- </ div >
56
- </ Card >
45
+ < div className = 'flex justify-between' >
46
+ < div className = 'flex space-x-3 hover:text-black dark:hover:text-white' >
47
+ { /* 两个社交按钮 */ }
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' />
57
+ </ Link >
58
+ ) }
59
+ </ div >
60
+ </ div >
61
+ < MoreButton />
62
+ </ div >
63
+ </ Card >
57
64
)
58
65
}
59
66
@@ -69,20 +76,33 @@ function GreetingsWords() {
69
76
setGreeting ( greetings [ randomIndex ] )
70
77
}
71
78
72
- return < div onClick = { handleChangeGreeting } className = ' select-none cursor-pointer py-1 px-2 bg-indigo-400 hover:bg-indigo-50 hover:text-indigo-950 dark:bg-yellow-500 dark:hover:text-white dark:hover:bg-black text-sm rounded-lg duration-200 transition-colors' >
73
- { greeting }
79
+ return (
80
+ < div
81
+ onClick = { handleChangeGreeting }
82
+ className = ' select-none cursor-pointer py-1 px-2 bg-indigo-400 hover:bg-indigo-50 hover:text-indigo-950 dark:bg-yellow-500 dark:hover:text-white dark:hover:bg-black text-sm rounded-lg duration-200 transition-colors' >
83
+ { greeting }
74
84
</ div >
85
+ )
75
86
}
76
87
77
88
/**
78
89
* 了解更多按鈕
79
90
* @returns
80
91
*/
81
92
function MoreButton ( ) {
82
- return < Link href = '/about' >
83
- < div className = { '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' } >
84
- < ArrowRightCircle className = { 'group-hover:stroke-black dark:group-hover:stroke-white w-6 h-6 transition-all duration-100' } />
85
- < div className = 'font-bold' > 了解更多</ div >
86
- </ div >
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 >
87
106
</ Link >
107
+ )
88
108
}
0 commit comments