|
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' |
10 | 1 | import * as React from 'react'
|
| 2 | +import cs from 'classnames' |
| 3 | +import { IoMoonSharp, IoSunnyOutline } from 'react-icons/io5' |
11 | 4 |
|
12 | 5 | import * as config from '@/lib/config'
|
13 | 6 | import { useDarkMode } from '@/lib/use-dark-mode'
|
| 7 | +import { PageSocialButtons } from './PageSocial' |
14 | 8 |
|
15 | 9 | import styles from './styles.module.css'
|
16 | 10 | import { StaticLogo } from './StaticLogo'
|
17 | 11 | import { footerLinks } from '@/lib/config'
|
18 | 12 | import { useNotionContext } from 'react-notion-x'
|
19 |
| -import cs from 'classnames' |
20 | 13 |
|
21 | 14 | // TODO: merge the data and icons from PageSocial with the social links in Footer
|
22 | 15 |
|
@@ -57,126 +50,45 @@ export function FooterImpl() {
|
57 | 50 | </a>
|
58 | 51 | )}
|
59 | 52 | </div>
|
60 |
| - |
61 | 53 | <div className={styles.social}>
|
62 |
| - {config.twitter && ( |
63 |
| - <a |
64 |
| - className={styles.twitter} |
65 |
| - href={`https://twitter.com/${config.twitter}`} |
66 |
| - title={`Twitter @${config.twitter}`} |
67 |
| - target='_blank' |
68 |
| - rel='noopener noreferrer' |
69 |
| - > |
70 |
| - <FaTwitter /> |
71 |
| - </a> |
72 |
| - )} |
73 |
| - |
74 |
| - {config.mastodon && ( |
75 |
| - <a |
76 |
| - className={styles.mastodon} |
77 |
| - href={config.mastodon} |
78 |
| - title={`Mastodon ${config.getMastodonHandle()}`} |
79 |
| - rel='me' |
80 |
| - > |
81 |
| - <FaMastodon /> |
82 |
| - </a> |
83 |
| - )} |
84 |
| - |
85 |
| - {config.zhihu && ( |
86 |
| - <a |
87 |
| - className={styles.zhihu} |
88 |
| - href={`https://zhihu.com/people/${config.zhihu}`} |
89 |
| - title={`Zhihu @${config.zhihu}`} |
90 |
| - target='_blank' |
91 |
| - rel='noopener noreferrer' |
92 |
| - > |
93 |
| - <FaZhihu /> |
94 |
| - </a> |
95 |
| - )} |
96 |
| - |
97 |
| - {config.github && ( |
98 |
| - <a |
99 |
| - className={styles.github} |
100 |
| - href={`https://github.com/${config.github}`} |
101 |
| - title={`GitHub @${config.github}`} |
102 |
| - target='_blank' |
103 |
| - rel='noopener noreferrer' |
104 |
| - > |
105 |
| - <FaGithub /> |
106 |
| - </a> |
107 |
| - )} |
108 |
| - |
109 |
| - {config.linkedin && ( |
110 |
| - <a |
111 |
| - className={styles.linkedin} |
112 |
| - href={`https://www.linkedin.com/in/${config.linkedin}`} |
113 |
| - title={`LinkedIn ${config.author}`} |
114 |
| - target='_blank' |
115 |
| - rel='noopener noreferrer' |
116 |
| - > |
117 |
| - <FaLinkedin /> |
118 |
| - </a> |
119 |
| - )} |
120 |
| - |
121 |
| - {config.newsletter && ( |
122 |
| - <a |
123 |
| - className={styles.newsletter} |
124 |
| - href={`${config.newsletter}`} |
125 |
| - title={`Newsletter ${config.author}`} |
126 |
| - target='_blank' |
127 |
| - rel='noopener noreferrer' |
128 |
| - > |
129 |
| - <FaEnvelopeOpenText /> |
130 |
| - </a> |
131 |
| - )} |
132 |
| - |
133 |
| - {config.youtube && ( |
134 |
| - <a |
135 |
| - className={styles.youtube} |
136 |
| - href={`https://www.youtube.com/${config.youtube}`} |
137 |
| - title={`YouTube ${config.author}`} |
138 |
| - target='_blank' |
139 |
| - rel='noopener noreferrer' |
140 |
| - > |
141 |
| - <FaYoutube /> |
142 |
| - </a> |
143 |
| - )} |
| 54 | + <PageSocialButtons iconSize={32} /> |
144 | 55 | </div>
|
145 | 56 | </div>
|
146 |
| - <div className="SiteInfo"> |
147 |
| - <div className={styles.siteInfoLinks}> |
148 |
| - {footerLinks |
149 |
| - ?.map((link, index) => { |
150 |
| - if (!link.pageId && !link.url) { |
151 |
| - return null |
152 |
| - } |
153 | 57 |
|
154 |
| - if (link.pageId) { |
155 |
| - return ( |
156 |
| - <components.PageLink |
157 |
| - href={mapPageUrl(link.pageId)} |
158 |
| - key={index} |
159 |
| - className={cs(styles.navLink, 'breadcrumb', 'button')} |
160 |
| - > |
161 |
| - {link.title} |
162 |
| - </components.PageLink> |
163 |
| - ) |
164 |
| - } else { |
165 |
| - return ( |
166 |
| - <components.Link |
167 |
| - href={link.url} |
168 |
| - key={index} |
169 |
| - className={cs(styles.navLink, 'breadcrumb', 'button')} |
170 |
| - > |
171 |
| - {link.title} |
172 |
| - </components.Link> |
173 |
| - ) |
174 |
| - } |
175 |
| - }) |
176 |
| - .filter(Boolean)} |
| 58 | + <div className="SiteInfo"> |
| 59 | + <div className={styles.siteInfoLinks}> |
| 60 | + {footerLinks |
| 61 | + ?.map((link, index) => { |
| 62 | + if (!link.pageId && !link.url) { |
| 63 | + return null |
| 64 | + } |
| 65 | + |
| 66 | + if (link.pageId) { |
| 67 | + return ( |
| 68 | + <components.PageLink |
| 69 | + href={mapPageUrl(link.pageId)} |
| 70 | + key={index} |
| 71 | + className={cs(styles.navLink, 'breadcrumb', 'button')} |
| 72 | + > |
| 73 | + {link.title} |
| 74 | + </components.PageLink> |
| 75 | + ) |
| 76 | + } else { |
| 77 | + return ( |
| 78 | + <components.Link |
| 79 | + href={link.url} |
| 80 | + key={index} |
| 81 | + className={cs(styles.navLink, 'breadcrumb', 'button')} |
| 82 | + > |
| 83 | + {link.title} |
| 84 | + </components.Link> |
| 85 | + ) |
| 86 | + } |
| 87 | + }) |
| 88 | + .filter(Boolean)} |
| 89 | + </div> |
| 90 | + <div className={styles.copyright}>© Copyright {currentYear}. All rights reserved.</div> |
177 | 91 | </div>
|
178 |
| - <div className={styles.copyright}>© Copyright {currentYear}. All rights reserved.</div> |
179 |
| - </div> |
180 | 92 | </footer>
|
181 | 93 | )
|
182 | 94 | }
|
|
0 commit comments