mirror of
https://github.com/d0zingcat/nextjs-notion-starter-kit.git
synced 2026-05-13 15:09:47 +00:00
145 lines
4.0 KiB
TypeScript
145 lines
4.0 KiB
TypeScript
import { FaEnvelopeOpenText } from '@react-icons/all-files/fa/FaEnvelopeOpenText'
|
|
import { FaGithub } from '@react-icons/all-files/fa/FaGithub'
|
|
import { FaLinkedin } from '@react-icons/all-files/fa/FaLinkedin'
|
|
import { FaMastodon } from '@react-icons/all-files/fa/FaMastodon'
|
|
import { FaTwitter } from '@react-icons/all-files/fa/FaTwitter'
|
|
import { FaYoutube } from '@react-icons/all-files/fa/FaYoutube'
|
|
import { FaZhihu } from '@react-icons/all-files/fa/FaZhihu'
|
|
import { IoMoonSharp } from '@react-icons/all-files/io5/IoMoonSharp'
|
|
import { IoSunnyOutline } from '@react-icons/all-files/io5/IoSunnyOutline'
|
|
import * as React from 'react'
|
|
|
|
import * as config from '@/lib/config'
|
|
import { useDarkMode } from '@/lib/use-dark-mode'
|
|
|
|
import styles from './styles.module.css'
|
|
|
|
// TODO: merge the data and icons from PageSocial with the social links in Footer
|
|
|
|
export function FooterImpl() {
|
|
const [hasMounted, setHasMounted] = React.useState(false)
|
|
const { isDarkMode, toggleDarkMode } = useDarkMode()
|
|
const currentYear = new Date().getFullYear()
|
|
|
|
const onToggleDarkMode = React.useCallback(
|
|
(e: any) => {
|
|
e.preventDefault()
|
|
toggleDarkMode()
|
|
},
|
|
[toggleDarkMode]
|
|
)
|
|
|
|
React.useEffect(() => {
|
|
setHasMounted(true)
|
|
}, [])
|
|
|
|
return (
|
|
<footer className={styles.footer}>
|
|
<div className={styles.copyright}>
|
|
Copyright {currentYear} {config.author}
|
|
</div>
|
|
|
|
<div className={styles.settings}>
|
|
{hasMounted && (
|
|
<a
|
|
className={styles.toggleDarkMode}
|
|
href='#'
|
|
role='button'
|
|
onClick={onToggleDarkMode}
|
|
title='Toggle dark mode'
|
|
>
|
|
{isDarkMode ? <IoMoonSharp /> : <IoSunnyOutline />}
|
|
</a>
|
|
)}
|
|
</div>
|
|
|
|
<div className={styles.social}>
|
|
{config.twitter && (
|
|
<a
|
|
className={styles.twitter}
|
|
href={`https://twitter.com/${config.twitter}`}
|
|
title={`Twitter @${config.twitter}`}
|
|
target='_blank'
|
|
rel='noopener noreferrer'
|
|
>
|
|
<FaTwitter />
|
|
</a>
|
|
)}
|
|
|
|
{config.mastodon && (
|
|
<a
|
|
className={styles.mastodon}
|
|
href={config.mastodon}
|
|
title={`Mastodon ${config.getMastodonHandle()}`}
|
|
rel='me'
|
|
>
|
|
<FaMastodon />
|
|
</a>
|
|
)}
|
|
|
|
{config.zhihu && (
|
|
<a
|
|
className={styles.zhihu}
|
|
href={`https://zhihu.com/people/${config.zhihu}`}
|
|
title={`Zhihu @${config.zhihu}`}
|
|
target='_blank'
|
|
rel='noopener noreferrer'
|
|
>
|
|
<FaZhihu />
|
|
</a>
|
|
)}
|
|
|
|
{config.github && (
|
|
<a
|
|
className={styles.github}
|
|
href={`https://github.com/${config.github}`}
|
|
title={`GitHub @${config.github}`}
|
|
target='_blank'
|
|
rel='noopener noreferrer'
|
|
>
|
|
<FaGithub />
|
|
</a>
|
|
)}
|
|
|
|
{config.linkedin && (
|
|
<a
|
|
className={styles.linkedin}
|
|
href={`https://www.linkedin.com/in/${config.linkedin}`}
|
|
title={`LinkedIn ${config.author}`}
|
|
target='_blank'
|
|
rel='noopener noreferrer'
|
|
>
|
|
<FaLinkedin />
|
|
</a>
|
|
)}
|
|
|
|
{config.newsletter && (
|
|
<a
|
|
className={styles.newsletter}
|
|
href={`${config.newsletter}`}
|
|
title={`Newsletter ${config.author}`}
|
|
target='_blank'
|
|
rel='noopener noreferrer'
|
|
>
|
|
<FaEnvelopeOpenText />
|
|
</a>
|
|
)}
|
|
|
|
{config.youtube && (
|
|
<a
|
|
className={styles.youtube}
|
|
href={`https://www.youtube.com/${config.youtube}`}
|
|
title={`YouTube ${config.author}`}
|
|
target='_blank'
|
|
rel='noopener noreferrer'
|
|
>
|
|
<FaYoutube />
|
|
</a>
|
|
)}
|
|
</div>
|
|
</footer>
|
|
)
|
|
}
|
|
|
|
export const Footer = React.memo(FooterImpl)
|