From 5347ffe7db14e59d10bbbc46d55eae2036392bbc Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 31 Oct 2024 12:19:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E5=88=86=E7=BB=84=E4=BB=B6=E7=BB=9F?= =?UTF-8?q?=E4=B8=80;magzine=E9=A1=B5=E8=84=9A=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/AnalyticsBusuanzi.js | 18 ++ components/{GongAnBeiAn.js => BeiAnGongAn.js} | 6 +- components/BeiAnSite.js | 21 ++ components/CopyRightDate.js | 26 ++ components/PoweredBy.js | 20 ++ public/svg/zhishixingqiu-white.svg | 1 + themes/commerce/components/Footer.js | 26 +- themes/example/components/Footer.js | 43 +-- themes/fukasawa/components/SiteInfo.js | 4 +- themes/gitbook/components/Footer.js | 4 +- themes/heo/components/Footer.js | 4 +- themes/hexo/components/Footer.js | 26 +- themes/magzine/components/Footer.js | 54 +--- themes/magzine/components/SocialButton.js | 261 ++++++++++++------ themes/magzine/index.js | 10 +- themes/matery/components/Footer.js | 4 +- themes/medium/components/Footer.js | 4 +- themes/movie/components/Footer.js | 4 +- themes/nav/components/Footer.js | 4 +- themes/next/components/Footer.js | 4 +- themes/simple/components/Footer.js | 4 +- 21 files changed, 324 insertions(+), 224 deletions(-) create mode 100644 components/AnalyticsBusuanzi.js rename components/{GongAnBeiAn.js => BeiAnGongAn.js} (79%) create mode 100644 components/BeiAnSite.js create mode 100644 components/CopyRightDate.js create mode 100644 components/PoweredBy.js create mode 100644 public/svg/zhishixingqiu-white.svg diff --git a/components/AnalyticsBusuanzi.js b/components/AnalyticsBusuanzi.js new file mode 100644 index 00000000..3248e45d --- /dev/null +++ b/components/AnalyticsBusuanzi.js @@ -0,0 +1,18 @@ +/** + * 不蒜子统计 访客和阅读量 + * @returns + */ +export default function AnalyticsBusuanzi() { + return ( +
+ + + + + + + + +
+ ) +} diff --git a/components/GongAnBeiAn.js b/components/BeiAnGongAn.js similarity index 79% rename from components/GongAnBeiAn.js rename to components/BeiAnGongAn.js index 349427fd..13c2be1d 100644 --- a/components/GongAnBeiAn.js +++ b/components/BeiAnGongAn.js @@ -5,7 +5,7 @@ import LazyImage from './LazyImage' * 公安备案号组件 * @returns */ -export const GongAnBeiAn = () => { +export const BeiAnGongAn = props => { const BEI_AN_GONGAN = siteConfig('BEI_AN_GONGAN') // 从BEI_AN_GONGAN 字段中利用正则匹配提取出纯数字部分 const codeMatch = BEI_AN_GONGAN?.match(/\d+/) // 匹配纯数字 @@ -17,9 +17,9 @@ export const GongAnBeiAn = () => { return null } return ( -
+
- + {BEI_AN_GONGAN}
diff --git a/components/BeiAnSite.js b/components/BeiAnSite.js new file mode 100644 index 00000000..d7c93121 --- /dev/null +++ b/components/BeiAnSite.js @@ -0,0 +1,21 @@ +import { siteConfig } from '@/lib/config' + +/** + * 站点域名备案 + * @returns + */ +export default function BeiAnSite() { + const beian = siteConfig('BEI_AN') + if (!beian) { + return null + } + return ( + + + + {siteConfig('BEI_AN')} + +
+
+ ) +} diff --git a/components/CopyRightDate.js b/components/CopyRightDate.js new file mode 100644 index 00000000..e7858422 --- /dev/null +++ b/components/CopyRightDate.js @@ -0,0 +1,26 @@ +import { siteConfig } from '@/lib/config' + +/** + * 网站版权日期 + * 示例: 2021-2024 + * @returns + */ +export default function CopyRightDate() { + const d = new Date() + const currentYear = d.getFullYear() + const since = siteConfig('SINCE') + const copyrightDate = + parseInt(since) < currentYear ? since + '-' + currentYear : currentYear + + return ( + + + {copyrightDate} + + {siteConfig('AUTHOR')} + + + ) +} diff --git a/components/PoweredBy.js b/components/PoweredBy.js new file mode 100644 index 00000000..e07825ea --- /dev/null +++ b/components/PoweredBy.js @@ -0,0 +1,20 @@ +import { siteConfig } from '@/lib/config' + +/** + * 驱动版权 + * @returns + */ +export default function PoweredBy(props) { + return ( + + ) +} diff --git a/public/svg/zhishixingqiu-white.svg b/public/svg/zhishixingqiu-white.svg new file mode 100644 index 00000000..d9a72ede --- /dev/null +++ b/public/svg/zhishixingqiu-white.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/themes/commerce/components/Footer.js b/themes/commerce/components/Footer.js index dbe0d224..3411773c 100644 --- a/themes/commerce/components/Footer.js +++ b/themes/commerce/components/Footer.js @@ -1,4 +1,6 @@ -import { GongAnBeiAn } from '@/components/GongAnBeiAn' +import { BeiAnGongAn } from '@/components/BeiAnGongAn' +import BeiAnSite from '@/components/BeiAnSite' +import CopyRightDate from '@/components/CopyRightDate' import { siteConfig } from '@/lib/config' import Link from 'next/link' import CONFIG from '../config' @@ -186,14 +188,7 @@ const Footer = props => {
{/* 网站所有者 */}
- {' '} - Copyright {`${copyrightDate}`}{' '} - - {siteConfig('AUTHOR')} - {' '} - All Rights Reserved. +
{/* 技术支持 */} @@ -227,15 +222,10 @@ const Footer = props => {

{siteConfig('DESCRIPTION')}

{/* 可选备案信息 */} - {siteConfig('BEI_AN') && ( - <> - {' '} - - {siteConfig('BEI_AN')} - - - )} - +
+ + +
diff --git a/themes/example/components/Footer.js b/themes/example/components/Footer.js index 02614f9d..029a31b7 100644 --- a/themes/example/components/Footer.js +++ b/themes/example/components/Footer.js @@ -1,44 +1,25 @@ +import { BeiAnGongAn } from '@/components/BeiAnGongAn' +import BeiAnSite from '@/components/BeiAnSite' +import CopyRightDate from '@/components/CopyRightDate' import DarkModeButton from '@/components/DarkModeButton' -import { GongAnBeiAn } from '@/components/GongAnBeiAn' -import { siteConfig } from '@/lib/config' +import PoweredBy from '@/components/PoweredBy' export const Footer = props => { - const d = new Date() - const currentYear = d.getFullYear() - const since = siteConfig('SINCE') - const copyrightDate = - parseInt(since) < currentYear ? since + '-' + currentYear : currentYear - return ( -
+ diff --git a/themes/fukasawa/components/SiteInfo.js b/themes/fukasawa/components/SiteInfo.js index 37397c52..1052ae47 100644 --- a/themes/fukasawa/components/SiteInfo.js +++ b/themes/fukasawa/components/SiteInfo.js @@ -1,4 +1,4 @@ -import { GongAnBeiAn } from '@/components/GongAnBeiAn' +import { BeiAnGongAn } from '@/components/BeiAnGongAn' import { siteConfig } from '@/lib/config' function SiteInfo({ title }) { @@ -28,7 +28,7 @@ function SiteInfo({ title }) {
)} - + diff --git a/themes/gitbook/components/Footer.js b/themes/gitbook/components/Footer.js index 558f03d1..b9929d64 100644 --- a/themes/gitbook/components/Footer.js +++ b/themes/gitbook/components/Footer.js @@ -1,4 +1,4 @@ -import { GongAnBeiAn } from '@/components/GongAnBeiAn' +import { BeiAnGongAn } from '@/components/BeiAnGongAn' import { siteConfig } from '@/lib/config' import SocialButton from './SocialButton' /** @@ -36,7 +36,7 @@ const Footer = ({ siteInfo }) => { {siteConfig('BEI_AN')} - +
)} diff --git a/themes/heo/components/Footer.js b/themes/heo/components/Footer.js index 83e53e52..81bf7951 100644 --- a/themes/heo/components/Footer.js +++ b/themes/heo/components/Footer.js @@ -1,4 +1,4 @@ -import { GongAnBeiAn } from '@/components/GongAnBeiAn' +import { BeiAnGongAn } from '@/components/BeiAnGongAn' import { siteConfig } from '@/lib/config' import SocialButton from './SocialButton' @@ -48,7 +48,7 @@ const Footer = ({ title }) => { )} - + diff --git a/themes/hexo/components/Footer.js b/themes/hexo/components/Footer.js index 60514c0d..af16bb5d 100644 --- a/themes/hexo/components/Footer.js +++ b/themes/hexo/components/Footer.js @@ -1,4 +1,6 @@ -import { GongAnBeiAn } from '@/components/GongAnBeiAn' +import { BeiAnGongAn } from '@/components/BeiAnGongAn' +import BeiAnSite from '@/components/BeiAnSite' +import PoweredBy from '@/components/PoweredBy' import { siteConfig } from '@/lib/config' const Footer = ({ title }) => { @@ -20,16 +22,8 @@ const Footer = ({ title }) => { {siteConfig('AUTHOR')} .
- {siteConfig('BEI_AN') && ( - <> - - - {siteConfig('BEI_AN')} - -
- - )} - + + @@ -41,15 +35,7 @@ const Footer = ({ title }) => {

{title} {siteConfig('BIO') && <>|} {siteConfig('BIO')}

-

- Powered by - - NotionNext {siteConfig('VERSION')} - - . -

+

diff --git a/themes/magzine/components/Footer.js b/themes/magzine/components/Footer.js index bb1fcd37..c5db92e1 100644 --- a/themes/magzine/components/Footer.js +++ b/themes/magzine/components/Footer.js @@ -1,6 +1,10 @@ +import AnalyticsBusuanzi from '@/components/AnalyticsBusuanzi' +import { BeiAnGongAn } from '@/components/BeiAnGongAn' +import BeiAnSite from '@/components/BeiAnSite' +import CopyRightDate from '@/components/CopyRightDate' import DarkModeButton from '@/components/DarkModeButton' -import { GongAnBeiAn } from '@/components/GongAnBeiAn' import LazyImage from '@/components/LazyImage' +import PoweredBy from '@/components/PoweredBy' import { siteConfig } from '@/lib/config' import { useGlobal } from '@/lib/global' import Link from 'next/link' @@ -10,11 +14,6 @@ import SocialButton from './SocialButton' * 网页底脚 */ const Footer = ({ title }) => { - const d = new Date() - const currentYear = d.getFullYear() - const since = siteConfig('SINCE') - const copyrightDate = - parseInt(since) < currentYear ? since + '-' + currentYear : currentYear const { siteInfo } = useGlobal() const MAGZINE_FOOTER_LINKS = siteConfig('MAGZINE_FOOTER_LINKS', []) @@ -71,49 +70,26 @@ const Footer = ({ title }) => { {/* 页脚 */}
-
- {`${copyrightDate}`} - - {siteConfig('BEI_AN') && ( - <> - - - {siteConfig('BEI_AN')} - -
- - )} - - - +
+ +
-
- - - - - - - - -
+
+ + {/* 备案 */} +
+ + +
) diff --git a/themes/magzine/components/SocialButton.js b/themes/magzine/components/SocialButton.js index 5ef31889..5b3a3954 100644 --- a/themes/magzine/components/SocialButton.js +++ b/themes/magzine/components/SocialButton.js @@ -1,4 +1,6 @@ +import QrCode from '@/components/QrCode' import { siteConfig } from '@/lib/config' +import { useState } from 'react' /** * 社交联系方式按钮组 @@ -6,98 +8,175 @@ import { siteConfig } from '@/lib/config' * @constructor */ const SocialButton = () => { + const CONTACT_GITHUB = siteConfig('CONTACT_GITHUB') + const CONTACT_TWITTER = siteConfig('CONTACT_TWITTER') + const CONTACT_TELEGRAM = siteConfig('CONTACT_TELEGRAM') + + const CONTACT_LINKEDIN = siteConfig('CONTACT_LINKEDIN') + const CONTACT_WEIBO = siteConfig('CONTACT_WEIBO') + const CONTACT_INSTAGRAM = siteConfig('CONTACT_INSTAGRAM') + const CONTACT_EMAIL = siteConfig('CONTACT_EMAIL') + const ENABLE_RSS = siteConfig('ENABLE_RSS') + const CONTACT_BILIBILI = siteConfig('CONTACT_BILIBILI') + const CONTACT_YOUTUBE = siteConfig('CONTACT_YOUTUBE') + + const CONTACT_XIAOHONGSHU = siteConfig('CONTACT_XIAOHONGSHU') + const CONTACT_ZHISHIXINGQIU = siteConfig('CONTACT_ZHISHIXINGQIU') + const CONTACT_WEHCHAT_PUBLIC = siteConfig('CONTACT_WEHCHAT_PUBLIC') + const [qrCodeShow, setQrCodeShow] = useState(false) + const openPopover = () => { + setQrCodeShow(true) + } + const closePopover = () => { + setQrCodeShow(false) + } + return ( -
- {siteConfig('CONTACT_GITHUB') && ( - - - - )} - {siteConfig('CONTACT_TWITTER') && ( - - - - )} - {siteConfig('CONTACT_TELEGRAM') && ( - - - - )} - {siteConfig('CONTACT_LINKEDIN') && ( - - - - )} - {siteConfig('CONTACT_WEIBO') && ( - - - - )} - {siteConfig('CONTACT_INSTAGRAM') && ( - - - - )} - {siteConfig('CONTACT_EMAIL') && ( - - - - )} - {JSON.parse(siteConfig('ENABLE_RSS')) && ( - - - - )} - {siteConfig('CONTACT_BILIBILI') && ( - - - - )} - {siteConfig('CONTACT_YOUTUBE') && ( - - - - )} +
+
+ {CONTACT_GITHUB && ( + + + + )} + {CONTACT_TWITTER && ( + + + + )} + {CONTACT_TELEGRAM && ( + + + + )} + {CONTACT_LINKEDIN && ( + + + + )} + {CONTACT_WEIBO && ( + + + + )} + {CONTACT_INSTAGRAM && ( + + + + )} + {CONTACT_EMAIL && ( + + + + )} + {ENABLE_RSS && ( + + + + )} + {CONTACT_BILIBILI && ( + + + + )} + {CONTACT_YOUTUBE && ( + + + + )} + {CONTACT_XIAOHONGSHU && ( + + {/* eslint-disable-next-line @next/next/no-img-element */} + 小红书 + + )} + {CONTACT_ZHISHIXINGQIU && ( + + {/* eslint-disable-next-line @next/next/no-img-element */} + 知识星球{' '} + + )} + {CONTACT_WEHCHAT_PUBLIC && ( + + )} +
) } diff --git a/themes/magzine/index.js b/themes/magzine/index.js index ffcd69dd..1b01c3bb 100644 --- a/themes/magzine/index.js +++ b/themes/magzine/index.js @@ -276,10 +276,12 @@ const LayoutSlug = props => { {/* 广告醒图 */} {/* 推荐关联文章 */} - + {recommendPosts && recommendPosts.length > 0 && ( + + )}
) diff --git a/themes/matery/components/Footer.js b/themes/matery/components/Footer.js index f40c22f7..474f0453 100644 --- a/themes/matery/components/Footer.js +++ b/themes/matery/components/Footer.js @@ -1,4 +1,4 @@ -import { GongAnBeiAn } from '@/components/GongAnBeiAn' +import { BeiAnGongAn } from '@/components/BeiAnGongAn' import { siteConfig } from '@/lib/config' const Footer = ({ title }) => { @@ -37,7 +37,7 @@ const Footer = ({ title }) => {
)} - + {' '} diff --git a/themes/medium/components/Footer.js b/themes/medium/components/Footer.js index b12773de..a33a7f99 100644 --- a/themes/medium/components/Footer.js +++ b/themes/medium/components/Footer.js @@ -1,5 +1,5 @@ +import { BeiAnGongAn } from '@/components/BeiAnGongAn' import DarkModeButton from '@/components/DarkModeButton' -import { GongAnBeiAn } from '@/components/GongAnBeiAn' import { siteConfig } from '@/lib/config' const Footer = ({ title }) => { @@ -30,7 +30,7 @@ const Footer = ({ title }) => {
)} - + diff --git a/themes/movie/components/Footer.js b/themes/movie/components/Footer.js index a45cda50..4c251a40 100644 --- a/themes/movie/components/Footer.js +++ b/themes/movie/components/Footer.js @@ -1,5 +1,5 @@ +import { BeiAnGongAn } from '@/components/BeiAnGongAn' import DarkModeButton from '@/components/DarkModeButton' -import { GongAnBeiAn } from '@/components/GongAnBeiAn' import { siteConfig } from '@/lib/config' /** * 页脚 @@ -32,7 +32,7 @@ export const Footer = props => { {siteConfig('BEI_AN')} )} - + Powered by { @@ -43,7 +43,7 @@ const Footer = ({ siteInfo }) => {
)} - + diff --git a/themes/next/components/Footer.js b/themes/next/components/Footer.js index 8469139c..e46d7e6a 100644 --- a/themes/next/components/Footer.js +++ b/themes/next/components/Footer.js @@ -1,5 +1,5 @@ +import { BeiAnGongAn } from '@/components/BeiAnGongAn' import DarkModeButton from '@/components/DarkModeButton' -import { GongAnBeiAn } from '@/components/GongAnBeiAn' import { siteConfig } from '@/lib/config' const Footer = ({ title }) => { @@ -30,7 +30,7 @@ const Footer = ({ title }) => {
)} - + {' '} diff --git a/themes/simple/components/Footer.js b/themes/simple/components/Footer.js index e1de8655..afd8431e 100644 --- a/themes/simple/components/Footer.js +++ b/themes/simple/components/Footer.js @@ -1,5 +1,5 @@ +import { BeiAnGongAn } from '@/components/BeiAnGongAn' import DarkModeButton from '@/components/DarkModeButton' -import { GongAnBeiAn } from '@/components/GongAnBeiAn' import { siteConfig } from '@/lib/config' /** @@ -33,7 +33,7 @@ export default function Footer(props) { {siteConfig('BEI_AN')}
)} - + Powered by