mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-25 07:26:49 +00:00
Merge branch 'main' of https://github.com/tangly1024/NotionNext into main
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -36,6 +36,7 @@ yarn-error.log*
|
|||||||
# dev
|
# dev
|
||||||
/data.json
|
/data.json
|
||||||
/yarn.lock
|
/yarn.lock
|
||||||
|
/pnpm-lock.yaml
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ const BLOG = {
|
|||||||
CUSTOM_FONT_SANS: ['LXGW WenKai'], // 自定义无衬线字体
|
CUSTOM_FONT_SANS: ['LXGW WenKai'], // 自定义无衬线字体
|
||||||
CUSTOM_FONT_SERIF: ['LXGW WenKai'], // 自定义衬线字体
|
CUSTOM_FONT_SERIF: ['LXGW WenKai'], // 自定义衬线字体
|
||||||
|
|
||||||
|
// 侧栏布局 是否反转(左变右,右变左) 已支持主题: hexo next medium fukasawa example
|
||||||
|
LAYOUT_SIDEBAR_REVERSE: false,
|
||||||
|
|
||||||
// 一个小插件展示你的facebook fan page~ @see https://tw.andys.pro/article/add-facebook-fanpage-notionnext
|
// 一个小插件展示你的facebook fan page~ @see https://tw.andys.pro/article/add-facebook-fanpage-notionnext
|
||||||
FACEBOOK_PAGE_TITLE: process.env.NEXT_PUBLIC_FACEBOOK_PAGE_TITLE || null, // 邊欄 Facebook Page widget 的標題欄,填''則無標題欄 e.g FACEBOOK 粉絲團'
|
FACEBOOK_PAGE_TITLE: process.env.NEXT_PUBLIC_FACEBOOK_PAGE_TITLE || null, // 邊欄 Facebook Page widget 的標題欄,填''則無標題欄 e.g FACEBOOK 粉絲團'
|
||||||
FACEBOOK_PAGE: process.env.NEXT_PUBLIC_FACEBOOK_PAGE || null, // Facebook Page 的連結 e.g https://www.facebook.com/tw.andys.pro
|
FACEBOOK_PAGE: process.env.NEXT_PUBLIC_FACEBOOK_PAGE || null, // Facebook Page 的連結 e.g https://www.facebook.com/tw.andys.pro
|
||||||
@@ -68,6 +71,30 @@ const BLOG = {
|
|||||||
WIDGET_PET_LINK: 'https://cdn.jsdelivr.net/npm/live2d-widget-model-wanko@1.0.5/assets/wanko.model.json', // 挂件模型地址 @see https://github.com/xiazeyu/live2d-widget-models
|
WIDGET_PET_LINK: 'https://cdn.jsdelivr.net/npm/live2d-widget-model-wanko@1.0.5/assets/wanko.model.json', // 挂件模型地址 @see https://github.com/xiazeyu/live2d-widget-models
|
||||||
WIDGET_PET_SWITCH_THEME: true, // 点击宠物挂件切换博客主题
|
WIDGET_PET_SWITCH_THEME: true, // 点击宠物挂件切换博客主题
|
||||||
|
|
||||||
|
// 音乐播放插件
|
||||||
|
MUSIC_PLAYER: process.env.NEXT_PUBLIC_MUSIC_PLAYER || false, // 是否使用音乐播放插件
|
||||||
|
MUSIC_PLAYER_VISIBLE: process.env.NEXT_PUBLIC_MUSIC_PLAYER_VISIBLE || true, // 是否在左下角显示播放和切换,如果使用播放器,打开自动播放再隐藏,就会以类似背景音乐的方式播放,无法取消和暂停
|
||||||
|
MUSIC_PLAYER_AUTO_PLAY: process.env.NEXT_PUBLIC_MUSIC_PLAYER_AUTO_PLAY || true, // 是否自动播放,不过自动播放时常不生效(移动设备不支持自动播放)
|
||||||
|
MUSIC_PLAYER_SHOW_LRC: process.env.NEXT_PUBLIC_MUSIC_PLAYER_SHOW_LRC || false, // 是否展示歌词(前提是有配置歌词路径,对 meting 无效)
|
||||||
|
MUSIC_PLAYER_ORDER: 'list', // 默认播放方式,顺序 list,随机 random
|
||||||
|
MUSIC_PLAYER_AUDIO_LIST: [ // 示例音乐列表。除了以下配置外,还可配置歌词,具体配置项看此文档 https://aplayer.js.org/#/zh-Hans/
|
||||||
|
{
|
||||||
|
name: '风を共に舞う気持ち',
|
||||||
|
artist: 'Falcom Sound Team jdk',
|
||||||
|
url: 'https://music.163.com/song/media/outer/url?id=731419.mp3',
|
||||||
|
cover: 'https://p2.music.126.net/kn6ugISTonvqJh3LHLaPtQ==/599233837187278.jpg'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '王都グランセル',
|
||||||
|
artist: 'Falcom Sound Team jdk',
|
||||||
|
url: 'https://music.163.com/song/media/outer/url?id=731355.mp3',
|
||||||
|
cover: 'https://p1.music.126.net/kn6ugISTonvqJh3LHLaPtQ==/599233837187278.jpg'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
MUSIC_PLAYER_METING: process.env.NEXT_PUBLIC_MUSIC_PLAYER_METING || false, // 是否要开启 MetingJS,从平台获取歌单。会覆盖自定义的 MUSIC_PLAYER_AUDIO_LIST,更多配置信息:https://github.com/metowolf/MetingJS
|
||||||
|
MUSIC_PLAYER_METING_SERVER: process.env.NEXT_PUBLIC_MUSIC_PLAYER_METING_SERVER || 'netease', // 音乐平台,[netease, tencent, kugou, xiami, baidu]
|
||||||
|
MUSIC_PLAYER_METING_ID: process.env.NEXT_PUBLIC_MUSIC_PLAYER_METING_ID || '60198', // 对应歌单的 id
|
||||||
|
|
||||||
// ----> 评论互动 可同时开启多个支持 WALINE VALINE GISCUS CUSDIS UTTERRANCES GITALK
|
// ----> 评论互动 可同时开启多个支持 WALINE VALINE GISCUS CUSDIS UTTERRANCES GITALK
|
||||||
|
|
||||||
// twikoo
|
// twikoo
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ const CommonScript = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</>)}
|
</>)}
|
||||||
|
|
||||||
|
{/* 引入音乐播放 */}
|
||||||
|
{JSON.parse(BLOG.MUSIC_PLAYER) && <script async src="https://cdnjs.cloudflare.com/ajax/libs/aplayer/1.10.1/APlayer.min.js" />}
|
||||||
|
{JSON.parse(BLOG.MUSIC_PLAYER) && JSON.parse(BLOG.MUSIC_PLAYER_METING) && <script async src="https://cdnjs.cloudflare.com/ajax/libs/meting/2.0.1/Meting.min.js" />}
|
||||||
</>)
|
</>)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
7
components/MusicPlayer.js
Normal file
7
components/MusicPlayer.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import dynamic from 'next/dynamic'
|
||||||
|
|
||||||
|
const MusicPlayer = dynamic(
|
||||||
|
() => import('@/components/Player'),
|
||||||
|
{ ssr: false }
|
||||||
|
)
|
||||||
|
export default MusicPlayer
|
||||||
52
components/Player.js
Normal file
52
components/Player.js
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import BLOG from '@/blog.config'
|
||||||
|
|
||||||
|
const Player = () => {
|
||||||
|
const [player, setPlayer] = React.useState()
|
||||||
|
const ref = React.useRef(null)
|
||||||
|
|
||||||
|
const showLrc = JSON.parse(BLOG.MUSIC_PLAYER_SHOW_LRC)
|
||||||
|
const playerVisible = JSON.parse(BLOG.MUSIC_PLAYER_VISIBLE)
|
||||||
|
const autoPlay = JSON.parse(BLOG.MUSIC_PLAYER_AUTO_PLAY)
|
||||||
|
|
||||||
|
const meting = JSON.parse(BLOG.MUSIC_PLAYER_METING)
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!meting && window.APlayer) {
|
||||||
|
setPlayer(new window.APlayer({
|
||||||
|
container: ref.current,
|
||||||
|
fixed: true,
|
||||||
|
showlrc: showLrc,
|
||||||
|
autoplay: autoPlay,
|
||||||
|
order: BLOG.MUSIC_PLAYER_ORDER,
|
||||||
|
audio: BLOG.MUSIC_PLAYER_AUDIO_LIST
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
return () => {
|
||||||
|
setPlayer(undefined)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={playerVisible ? 'visible' : 'invisible'}>
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
type="text/css"
|
||||||
|
href="https://cdnjs.cloudflare.com/ajax/libs/aplayer/1.10.1/APlayer.min.css"
|
||||||
|
/>
|
||||||
|
{meting
|
||||||
|
? <meting-js
|
||||||
|
fixed
|
||||||
|
type="playlist"
|
||||||
|
autoplay={autoPlay}
|
||||||
|
order={BLOG.MUSIC_PLAYER_ORDER}
|
||||||
|
server={BLOG.MUSIC_PLAYER_METING_SERVER}
|
||||||
|
id={BLOG.MUSIC_PLAYER_METING_ID}
|
||||||
|
/>
|
||||||
|
: <div ref={ref} data-player={player} />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Player
|
||||||
@@ -15,7 +15,7 @@ export function ThemeSwitch() {
|
|||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<Draggable>
|
<Draggable>
|
||||||
<div id="draggableBox" style={{ left: '10px', top: '90vh' }} className="fixed text-white bg-black z-50 rounded-lg shadow-card">
|
<div id="draggableBox" className="fixed left-1 bottom-20 text-white bg-black z-50 rounded-lg shadow-card">
|
||||||
<div className="p-2 flex items-center">
|
<div className="p-2 flex items-center">
|
||||||
<i className='fas fa-arrows cursor-move px-2' />
|
<i className='fas fa-arrows cursor-move px-2' />
|
||||||
{/* <div className='uppercase font-sans whitespace-nowrap cursor-pointer ' onClick={switchTheme}> {theme}</div> */}
|
{/* <div className='uppercase font-sans whitespace-nowrap cursor-pointer ' onClick={switchTheme}> {theme}</div> */}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { GlobalContextProvider } from '@/lib/global'
|
|||||||
import { DebugPanel } from '@/components/DebugPanel'
|
import { DebugPanel } from '@/components/DebugPanel'
|
||||||
import { ThemeSwitch } from '@/components/ThemeSwitch'
|
import { ThemeSwitch } from '@/components/ThemeSwitch'
|
||||||
import { Fireworks } from '@/components/Fireworks'
|
import { Fireworks } from '@/components/Fireworks'
|
||||||
|
import MusicPlayer from '@/components/MusicPlayer'
|
||||||
|
|
||||||
const Ackee = dynamic(() => import('@/components/Ackee'), { ssr: false })
|
const Ackee = dynamic(() => import('@/components/Ackee'), { ssr: false })
|
||||||
const Gtag = dynamic(() => import('@/components/Gtag'), { ssr: false })
|
const Gtag = dynamic(() => import('@/components/Gtag'), { ssr: false })
|
||||||
@@ -47,6 +48,7 @@ const MyApp = ({ Component, pageProps }) => {
|
|||||||
{BLOG.ADSENSE_GOOGLE_ID && <GoogleAdsense />}
|
{BLOG.ADSENSE_GOOGLE_ID && <GoogleAdsense />}
|
||||||
{BLOG.FACEBOOK_APP_ID && BLOG.FACEBOOK_PAGE_ID && <Messenger />}
|
{BLOG.FACEBOOK_APP_ID && BLOG.FACEBOOK_PAGE_ID && <Messenger />}
|
||||||
{JSON.parse(BLOG.FIREWORKS) && <Fireworks />}
|
{JSON.parse(BLOG.FIREWORKS) && <Fireworks />}
|
||||||
|
{JSON.parse(BLOG.MUSIC_PLAYER) && <MusicPlayer />}
|
||||||
</>
|
</>
|
||||||
|
|
||||||
// 默认Webfont: 请在font.js文件中检查font-family 新版改从npm本地导入;
|
// 默认Webfont: 请在font.js文件中检查font-family 新版改从npm本地导入;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Footer } from './components/Footer'
|
|||||||
import { Title } from './components/Title'
|
import { Title } from './components/Title'
|
||||||
import { SideBar } from './components/SideBar'
|
import { SideBar } from './components/SideBar'
|
||||||
import JumpToTopButton from './components/JumpToTopButton'
|
import JumpToTopButton from './components/JumpToTopButton'
|
||||||
|
import BLOG from '@/blog.config'
|
||||||
/**
|
/**
|
||||||
* 基础布局 采用左右两侧布局,移动端使用顶部导航栏
|
* 基础布局 采用左右两侧布局,移动端使用顶部导航栏
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ const LayoutBase = props => {
|
|||||||
|
|
||||||
<Title {...props} />
|
<Title {...props} />
|
||||||
|
|
||||||
<div className="container mx-auto justify-center md:flex items-start py-8 px-2">
|
<div className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'flex-row-reverse' : '') + ' container mx-auto justify-center md:flex items-start py-8 px-2'}>
|
||||||
|
|
||||||
<div className='w-full max-w-3xl xl:px-14 lg:px-4 '>{children}</div>
|
<div className='w-full max-w-3xl xl:px-14 lg:px-4 '>{children}</div>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import CommonHead from '@/components/CommonHead'
|
|||||||
import TopNav from './components/TopNav'
|
import TopNav from './components/TopNav'
|
||||||
import AsideLeft from './components/AsideLeft'
|
import AsideLeft from './components/AsideLeft'
|
||||||
import Live2D from '@/components/Live2D'
|
import Live2D from '@/components/Live2D'
|
||||||
|
import BLOG from '@/blog.config'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基础布局 采用左右两侧布局,移动端使用顶部导航栏
|
* 基础布局 采用左右两侧布局,移动端使用顶部导航栏
|
||||||
@@ -27,7 +28,7 @@ const LayoutBase = (props) => {
|
|||||||
return (<>
|
return (<>
|
||||||
<CommonHead meta={meta} />
|
<CommonHead meta={meta} />
|
||||||
<TopNav {...props}/>
|
<TopNav {...props}/>
|
||||||
<div className='flex'>
|
<div className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'flex-row-reverse' : '') + ' flex'}>
|
||||||
<AsideLeft {...props} slot={leftAreaSlot}/>
|
<AsideLeft {...props} slot={leftAreaSlot}/>
|
||||||
<main id='wrapper' className='flex w-full py-8 justify-center'>
|
<main id='wrapper' className='flex w-full py-8 justify-center'>
|
||||||
<div id='container-inner' className='2xl:max-w-6xl md:max-w-4xl w-full'>
|
<div id='container-inner' className='2xl:max-w-6xl md:max-w-4xl w-full'>
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ const LayoutBase = props => {
|
|||||||
<main id="wrapper" className="w-full py-8 md:px-8 lg:px-24 min-h-screen">
|
<main id="wrapper" className="w-full py-8 md:px-8 lg:px-24 min-h-screen">
|
||||||
<div
|
<div
|
||||||
id="container-inner"
|
id="container-inner"
|
||||||
className="pt-14 w-full mx-auto lg:flex lg:space-x-4 justify-center"
|
className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'flex-row-reverse' : '') + ' pt-14 w-full mx-auto lg:flex lg:space-x-4 justify-center'}
|
||||||
>
|
>
|
||||||
<div className="w-full max-w-4xl overflow-x-hidden scroll-hidden">
|
<div className="w-full max-w-4xl overflow-x-hidden scroll-hidden">
|
||||||
{onLoading ? <LoadingCover /> : children}
|
{onLoading ? <LoadingCover /> : children}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import BottomMenuBar from './components/BottomMenuBar'
|
|||||||
import { useGlobal } from '@/lib/global'
|
import { useGlobal } from '@/lib/global'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import Live2D from '@/components/Live2D'
|
import Live2D from '@/components/Live2D'
|
||||||
|
import BLOG from '@/blog.config'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基础布局 采用左右两侧布局,移动端使用顶部导航栏
|
* 基础布局 采用左右两侧布局,移动端使用顶部导航栏
|
||||||
@@ -26,7 +27,7 @@ const LayoutBase = props => {
|
|||||||
return (
|
return (
|
||||||
<div className='bg-white dark:bg-hexo-black-gray w-full h-full min-h-screen justify-center dark:text-gray-300'>
|
<div className='bg-white dark:bg-hexo-black-gray w-full h-full min-h-screen justify-center dark:text-gray-300'>
|
||||||
<CommonHead meta={meta} />
|
<CommonHead meta={meta} />
|
||||||
<main id='wrapper' className='flex justify-between w-full h-full mx-auto'>
|
<main id='wrapper' className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'flex-row-reverse' : '') + ' flex justify-between w-full h-full mx-auto'}>
|
||||||
{/* 桌面端左侧菜单 */}
|
{/* 桌面端左侧菜单 */}
|
||||||
{/* <LeftMenuBar/> */}
|
{/* <LeftMenuBar/> */}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import React from 'react'
|
|||||||
import smoothscroll from 'smoothscroll-polyfill'
|
import smoothscroll from 'smoothscroll-polyfill'
|
||||||
import CONFIG_NEXT from './config_next'
|
import CONFIG_NEXT from './config_next'
|
||||||
import Live2D from '@/components/Live2D'
|
import Live2D from '@/components/Live2D'
|
||||||
|
import BLOG from '@/blog.config'
|
||||||
import AOS from 'aos'
|
import AOS from 'aos'
|
||||||
import 'aos/dist/aos.css' // You can also use <link> for styles
|
import 'aos/dist/aos.css' // You can also use <link> for styles
|
||||||
import { isBrowser } from '@/lib/utils'
|
import { isBrowser } from '@/lib/utils'
|
||||||
@@ -75,7 +76,7 @@ const LayoutBase = (props) => {
|
|||||||
|
|
||||||
<div className='h-0.5 w-full bg-gray-700 dark:bg-gray-600 hidden lg:block'/>
|
<div className='h-0.5 w-full bg-gray-700 dark:bg-gray-600 hidden lg:block'/>
|
||||||
|
|
||||||
<main id='wrapper' className='flex justify-center flex-1 pb-12'>
|
<main id='wrapper' className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'flex-row-reverse' : '') + ' flex justify-center flex-1 pb-12'}>
|
||||||
{/* 左侧栏样式 */}
|
{/* 左侧栏样式 */}
|
||||||
<SideAreaLeft slot={leftAreaSlot} targetRef={targetRef} {...props}/>
|
<SideAreaLeft slot={leftAreaSlot} targetRef={targetRef} {...props}/>
|
||||||
<section id='container-inner' className={`${CONFIG_NEXT.NAV_TYPE !== 'normal' ? 'mt-40' : ''} lg:max-w-3xl xl:max-w-4xl flex-grow md:mt-0 min-h-screen w-full`} ref={targetRef}>
|
<section id='container-inner' className={`${CONFIG_NEXT.NAV_TYPE !== 'normal' ? 'mt-40' : ''} lg:max-w-3xl xl:max-w-4xl flex-grow md:mt-0 min-h-screen w-full`} ref={targetRef}>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import Tabs from '@/components/Tabs'
|
|||||||
import Logo from './Logo'
|
import Logo from './Logo'
|
||||||
import Card from './Card'
|
import Card from './Card'
|
||||||
import CONFIG_NEXT from '../config_next'
|
import CONFIG_NEXT from '../config_next'
|
||||||
|
import BLOG from '@/blog.config'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 侧边平铺
|
* 侧边平铺
|
||||||
@@ -22,7 +23,7 @@ const SideAreaLeft = props => {
|
|||||||
const { post, slot, postCount } = props
|
const { post, slot, postCount } = props
|
||||||
const { locale } = useGlobal()
|
const { locale } = useGlobal()
|
||||||
const showToc = post && post.toc && post.toc.length > 1
|
const showToc = post && post.toc && post.toc.length > 1
|
||||||
return <aside id='left' className='hidden lg:block flex-col w-60 mr-4'>
|
return <aside id='left' className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'ml-4' : 'mr-4') + ' hidden lg:block flex-col w-60'}>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
data-aos="fade-down"
|
data-aos="fade-down"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const SideAreaRight = (props) => {
|
|||||||
const { tags, currentTag, slot, categories, currentCategory } = props
|
const { tags, currentTag, slot, categories, currentCategory } = props
|
||||||
const { locale } = useGlobal()
|
const { locale } = useGlobal()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
return (<aside id='right' className='hidden 2xl:block flex-col w-60 ml-4'>
|
return (<aside id='right' className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'mr-4' : 'ml-4') + ' hidden 2xl:block flex-col w-60'}>
|
||||||
|
|
||||||
{CONFIG_NEXT.RIGHT_AD && <Card className='mb-2'>
|
{CONFIG_NEXT.RIGHT_AD && <Card className='mb-2'>
|
||||||
{/* 展示广告 */}
|
{/* 展示广告 */}
|
||||||
|
|||||||
Reference in New Issue
Block a user