Skip to content

Commit df887d9

Browse files
authored
5
1 parent d78d537 commit df887d9

1 file changed

Lines changed: 117 additions & 27 deletions

File tree

components/Footer.tsx

Lines changed: 117 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
import { FaEnvelopeOpenText } from '@react-icons/all-files/fa/FaEnvelopeOpenText'
2+
import { FaGithub } from '@react-icons/all-files/fa/FaGithub'
3+
import { FaLinkedin } from '@react-icons/all-files/fa/FaLinkedin'
4+
import { FaMastodon } from '@react-icons/all-files/fa/FaMastodon'
5+
import { FaTwitter } from '@react-icons/all-files/fa/FaTwitter'
6+
import { FaYoutube } from '@react-icons/all-files/fa/FaYoutube'
7+
import { FaZhihu } from '@react-icons/all-files/fa/FaZhihu'
8+
import { IoMoonSharp } from '@react-icons/all-files/io5/IoMoonSharp'
9+
import { IoSunnyOutline } from '@react-icons/all-files/io5/IoSunnyOutline'
110
import * as React from 'react'
211

3-
import { useDarkMode } from 'lib/use-dark-mode'
4-
import * as types from 'lib/types'
5-
import styles from './Footer.module.css'
6-
import { FooterConfig } from './Footer.config'
7-
import Script from 'next/script'
12+
import * as config from '@/lib/config'
13+
import { useDarkMode } from '@/lib/use-dark-mode'
14+
15+
import styles from './styles.module.css'
816

917
export function FooterImpl() {
1018
const [hasMounted, setHasMounted] = React.useState(false)
@@ -13,30 +21,112 @@ export function FooterImpl() {
1321

1422
React.useEffect(() => {
1523
setHasMounted(true)
16-
// 初始化 Ko-fi widget
17-
if (typeof window !== 'undefined' && (window as any).kofiWidgetOverlay) {
18-
(window as any).kofiWidgetOverlay.draw('meow828', {
19-
type: 'floating-chat',
20-
'floating-chat.donateButton.text': 'Support me',
21-
'floating-chat.donateButton.background-color': '#00b9fe',
22-
'floating-chat.donateButton.text-color': '#fff'
23-
})
24-
}
2524
}, [])
2625

2726
return (
28-
<>
29-
{/* 載入 Ko-fi overlay widget script */}
30-
<Script
31-
src="https://storage.ko-fi.com/cdn/scripts/overlay-widget.js"
32-
strategy="afterInteractive"
33-
/>
34-
<footer className={styles.footer}>
35-
{/* 你原本 footer 嘅內容保持唔變 */}
36-
<div className={styles.copyright}>
37-
© {currentYear} Meow828 • All rights reserved.
38-
</div>
39-
</footer>
40-
</>
27+
<footer className={styles.footer}>
28+
<div className={styles.copyright}>
29+
Copyright {currentYear} {config.author}
30+
</div>
31+
32+
<div className={styles.settings}>
33+
{hasMounted && (
34+
<a
35+
className={styles.toggleDarkMode}
36+
href='#'
37+
role='button'
38+
onClick={onToggleDarkMode}
39+
title='Toggle dark mode'
40+
>
41+
{isDarkMode ? <IoMoonSharp /> : <IoSunnyOutline />}
42+
</a>
43+
)}
44+
</div>
45+
46+
<div className={styles.social}>
47+
{config.twitter && (
48+
<a
49+
className={styles.twitter}
50+
href={`https://twitter.com/${config.twitter}`}
51+
title={`Twitter @${config.twitter}`}
52+
target='_blank'
53+
rel='noopener noreferrer'
54+
>
55+
<FaTwitter />
56+
</a>
57+
)}
58+
59+
{config.mastodon && (
60+
<a
61+
className={styles.mastodon}
62+
href={config.mastodon}
63+
title={`Mastodon ${config.getMastodonHandle()}`}
64+
rel='me'
65+
>
66+
<FaMastodon />
67+
</a>
68+
)}
69+
70+
{config.zhihu && (
71+
<a
72+
className={styles.zhihu}
73+
href={`https://zhihu.com/people/${config.zhihu}`}
74+
title={`Zhihu @${config.zhihu}`}
75+
target='_blank'
76+
rel='noopener noreferrer'
77+
>
78+
<FaZhihu />
79+
</a>
80+
)}
81+
82+
{config.github && (
83+
<a
84+
className={styles.github}
85+
href={`https://github.com/${config.github}`}
86+
title={`GitHub @${config.github}`}
87+
target='_blank'
88+
rel='noopener noreferrer'
89+
>
90+
<FaGithub />
91+
</a>
92+
)}
93+
94+
{config.linkedin && (
95+
<a
96+
className={styles.linkedin}
97+
href={`https://www.linkedin.com/in/${config.linkedin}`}
98+
title={`LinkedIn ${config.author}`}
99+
target='_blank'
100+
rel='noopener noreferrer'
101+
>
102+
<FaLinkedin />
103+
</a>
104+
)}
105+
106+
{config.newsletter && (
107+
<a
108+
className={styles.newsletter}
109+
href={`${config.newsletter}`}
110+
title={`Newsletter ${config.author}`}
111+
target='_blank'
112+
rel='noopener noreferrer'
113+
>
114+
<FaEnvelopeOpenText />
115+
</a>
116+
)}
117+
118+
{config.youtube && (
119+
<a
120+
className={styles.youtube}
121+
href={`https://www.youtube.com/${config.youtube}`}
122+
title={`YouTube ${config.author}`}
123+
target='_blank'
124+
rel='noopener noreferrer'
125+
>
126+
<FaYoutube />
127+
</a>
128+
)}
129+
</div>
130+
</footer>
41131
)
42132
}

0 commit comments

Comments
 (0)