mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 15:09:22 +00:00
Merge branch 'tangly1024:main' into main
This commit is contained in:
@@ -69,6 +69,9 @@ const BLOG = {
|
||||
// 樱花飘落特效
|
||||
SAKURA: process.env.NEXT_PUBLIC_SAKURA || true, // 开关
|
||||
|
||||
// 星空雨特效 黑夜模式才会生效
|
||||
STARRY_SKY: process.env.NEXT_PUBLIC_STARRY_SKY || false, // 开关
|
||||
|
||||
// 悬浮挂件
|
||||
WIDGET_PET: process.env.NEXT_PUBLIC_WIDGET_PET || true, // 是否显示宠物挂件
|
||||
WIDGET_PET_LINK: 'https://cdn.jsdelivr.net/npm/live2d-widget-model-unitychan@1.0.5/assets/unitychan.model.json', // 挂件模型地址 @see https://github.com/xiazeyu/live2d-widget-models
|
||||
|
||||
133
components/StarrySky.js
Normal file
133
components/StarrySky.js
Normal file
@@ -0,0 +1,133 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* https://codepen.io/juliangarnier/pen/gmOwJX
|
||||
* custom by hexo-theme-yun @YunYouJun
|
||||
*/
|
||||
import React from 'react'
|
||||
|
||||
export const StarrySky = () => {
|
||||
React.useEffect(() => {
|
||||
dark()
|
||||
}, [])
|
||||
return (
|
||||
<div className="relative">
|
||||
<canvas id="starry-sky-vixcity" className="fixed"></canvas>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建星空雨
|
||||
* @param config
|
||||
*/
|
||||
function dark() {
|
||||
window.requestAnimationFrame =
|
||||
window.requestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.msRequestAnimationFrame
|
||||
var n,
|
||||
e,
|
||||
i,
|
||||
h,
|
||||
t = 0.05,
|
||||
s = document.getElementById('starry-sky-vixcity'),
|
||||
o = !0,
|
||||
a = '180,184,240',
|
||||
r = '226,225,142',
|
||||
d = '226,225,224',
|
||||
c = []
|
||||
function f() {
|
||||
;(n = window.innerWidth),
|
||||
(e = window.innerHeight),
|
||||
(i = 0.216 * n),
|
||||
s.setAttribute('width', n),
|
||||
s.setAttribute('height', e)
|
||||
}
|
||||
function u() {
|
||||
h.clearRect(0, 0, n, e)
|
||||
for (var t = c.length, i = 0; i < t; i++) {
|
||||
var s = c[i]
|
||||
s.move(), s.fadeIn(), s.fadeOut(), s.draw()
|
||||
}
|
||||
}
|
||||
function y() {
|
||||
;(this.reset = function () {
|
||||
;(this.giant = m(3)),
|
||||
(this.comet = !this.giant && !o && m(10)),
|
||||
(this.x = l(0, n - 10)),
|
||||
(this.y = l(0, e)),
|
||||
(this.r = l(1.1, 2.6)),
|
||||
(this.dx = l(t, 6 * t) + (this.comet + 1 - 1) * t * l(50, 120) + 2 * t),
|
||||
(this.dy = -l(t, 6 * t) - (this.comet + 1 - 1) * t * l(50, 120)),
|
||||
(this.fadingOut = null),
|
||||
(this.fadingIn = !0),
|
||||
(this.opacity = 0),
|
||||
(this.opacityTresh = l(0.2, 1 - 0.4 * (this.comet + 1 - 1))),
|
||||
(this.do = l(5e-4, 0.002) + 0.001 * (this.comet + 1 - 1))
|
||||
}),
|
||||
(this.fadeIn = function () {
|
||||
this.fadingIn &&
|
||||
((this.fadingIn = !(this.opacity > this.opacityTresh)),
|
||||
(this.opacity += this.do))
|
||||
}),
|
||||
(this.fadeOut = function () {
|
||||
this.fadingOut &&
|
||||
((this.fadingOut = !(this.opacity < 0)),
|
||||
(this.opacity -= this.do / 2),
|
||||
(this.x > n || this.y < 0) && ((this.fadingOut = !1), this.reset()))
|
||||
}),
|
||||
(this.draw = function () {
|
||||
if ((h.beginPath(), this.giant))
|
||||
(h.fillStyle = 'rgba(' + a + ',' + this.opacity + ')'),
|
||||
h.arc(this.x, this.y, 2, 0, 2 * Math.PI, !1)
|
||||
else if (this.comet) {
|
||||
;(h.fillStyle = 'rgba(' + d + ',' + this.opacity + ')'),
|
||||
h.arc(this.x, this.y, 1.5, 0, 2 * Math.PI, !1)
|
||||
for (var t = 0; t < 30; t++)
|
||||
(h.fillStyle =
|
||||
'rgba(' +
|
||||
d +
|
||||
',' +
|
||||
(this.opacity - (this.opacity / 20) * t) +
|
||||
')'),
|
||||
h.rect(
|
||||
this.x - (this.dx / 4) * t,
|
||||
this.y - (this.dy / 4) * t - 2,
|
||||
2,
|
||||
2
|
||||
),
|
||||
h.fill()
|
||||
} else
|
||||
(h.fillStyle = 'rgba(' + r + ',' + this.opacity + ')'),
|
||||
h.rect(this.x, this.y, this.r, this.r)
|
||||
h.closePath(), h.fill()
|
||||
}),
|
||||
(this.move = function () {
|
||||
;(this.x += this.dx),
|
||||
(this.y += this.dy),
|
||||
!1 === this.fadingOut && this.reset(),
|
||||
(this.x > n - n / 4 || this.y < 0) && (this.fadingOut = !0)
|
||||
}),
|
||||
setTimeout(function () {
|
||||
o = !1
|
||||
}, 50)
|
||||
}
|
||||
function m(t) {
|
||||
return Math.floor(1e3 * Math.random()) + 1 < 10 * t
|
||||
}
|
||||
function l(t, i) {
|
||||
return Math.random() * (i - t) + t
|
||||
}
|
||||
f(),
|
||||
window.addEventListener('resize', f, !1),
|
||||
(function () {
|
||||
h = s.getContext('2d')
|
||||
for (var t = 0; t < i; t++) (c[t] = new y()), c[t].reset()
|
||||
u()
|
||||
})(),
|
||||
(function t() {
|
||||
document.getElementsByTagName('html')[0].className == 'dark' && u(),
|
||||
window.requestAnimationFrame(t)
|
||||
})()
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import { DebugPanel } from '@/components/DebugPanel'
|
||||
import { ThemeSwitch } from '@/components/ThemeSwitch'
|
||||
import { Fireworks } from '@/components/Fireworks'
|
||||
import { Sakura } from '@/components/Sakura'
|
||||
import { StarrySky } from '@/components/StarrySky'
|
||||
import MusicPlayer from '@/components/MusicPlayer'
|
||||
|
||||
const Ackee = dynamic(() => import('@/components/Ackee'), { ssr: false })
|
||||
@@ -50,6 +51,7 @@ const MyApp = ({ Component, pageProps }) => {
|
||||
{BLOG.FACEBOOK_APP_ID && BLOG.FACEBOOK_PAGE_ID && <Messenger />}
|
||||
{JSON.parse(BLOG.FIREWORKS) && <Fireworks />}
|
||||
{JSON.parse(BLOG.SAKURA) && <Sakura />}
|
||||
{JSON.parse(BLOG.STARRY_SKY) && <StarrySky />}
|
||||
{JSON.parse(BLOG.MUSIC_PLAYER) && <MusicPlayer />}
|
||||
</>
|
||||
|
||||
|
||||
@@ -6,9 +6,6 @@ import { useEffect, useState } from 'react'
|
||||
import CONFIG_MATERY from '../config_matery'
|
||||
|
||||
export default function ArticleCopyright () {
|
||||
if (!CONFIG_MATERY.ARTICLE_COPYRIGHT) {
|
||||
return <></>
|
||||
}
|
||||
const router = useRouter()
|
||||
const [path, setPath] = useState(BLOG.LINK + router.asPath)
|
||||
useEffect(() => {
|
||||
@@ -16,6 +13,11 @@ export default function ArticleCopyright () {
|
||||
})
|
||||
|
||||
const { locale } = useGlobal()
|
||||
|
||||
if (!CONFIG_MATERY.ARTICLE_COPYRIGHT) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="dark:text-gray-300 mt-6 mx-1 ">
|
||||
<ul className="overflow-x-auto whitespace-nowrap text-sm dark:bg-gray-900 bg-gray-100 p-5 leading-8 border-l-2 border-indigo-500">
|
||||
@@ -37,5 +39,5 @@ export default function ArticleCopyright () {
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export const ArticleInfo = (props) => {
|
||||
passHref
|
||||
className="cursor-pointer whitespace-nowrap">
|
||||
|
||||
<i className='far fa-calendar-minus fa-fw'/>发布日期:{date}
|
||||
<i className='far fa-calendar-minus fa-fw'/> 发布日期:{date}
|
||||
|
||||
</Link>
|
||||
<span className='whitespace-nowrap'>
|
||||
@@ -43,5 +43,5 @@ export const ArticleInfo = (props) => {
|
||||
</div>
|
||||
|
||||
</section>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) {
|
||||
</div>
|
||||
|
||||
</Link>)
|
||||
);
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => {
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ const CategoryGroup = ({ currentCategory, categories }) => {
|
||||
<div> <i className={`mr-2 fas ${selected ? 'fa-folder-open' : 'fa-folder'}`} />{category.name}({category.count})</div>
|
||||
|
||||
</Link>
|
||||
);
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</>;
|
||||
</>
|
||||
}
|
||||
|
||||
export default CategoryGroup
|
||||
|
||||
@@ -39,7 +39,7 @@ const HexoRecentComments = (props) => {
|
||||
</div>)}
|
||||
|
||||
</Card>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
export default HexoRecentComments
|
||||
|
||||
@@ -57,8 +57,8 @@ const LatestPostsGroup = ({ latestPosts, siteInfo }) => {
|
||||
</div>
|
||||
|
||||
</Link>)
|
||||
);
|
||||
)
|
||||
})}
|
||||
</>;
|
||||
</>
|
||||
}
|
||||
export default LatestPostsGroup
|
||||
|
||||
@@ -10,6 +10,6 @@ const Logo = props => {
|
||||
<div className=' text-lg p-1.5 rounded dark:border-white hover:scale-110 transform duration-200'> {siteInfo?.title || BLOG.TITLE}</div>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
)
|
||||
}
|
||||
export default Logo
|
||||
|
||||
@@ -36,12 +36,12 @@ const MenuButtonGroupTop = (props) => {
|
||||
</div>
|
||||
|
||||
</Link>
|
||||
);
|
||||
)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
)
|
||||
}
|
||||
export default MenuButtonGroupTop
|
||||
|
||||
@@ -34,12 +34,12 @@ const MenuGroupCard = (props) => {
|
||||
</div>
|
||||
|
||||
</Link>
|
||||
);
|
||||
)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
)
|
||||
}
|
||||
export default MenuGroupCard
|
||||
|
||||
@@ -41,12 +41,12 @@ const MenuList = (props) => {
|
||||
{link.slot}
|
||||
|
||||
</Link>
|
||||
);
|
||||
)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
)
|
||||
}
|
||||
export default MenuList
|
||||
|
||||
@@ -25,9 +25,9 @@ const NavButtonGroup = (props) => {
|
||||
className='text-center w-full md:mx-6 md:w-40 md:h-14 lg:h-20 h-14 justify-center items-center flex border-2 cursor-pointer rounded-lg glassmorphism hover:bg-white hover:text-black duration-200 font-bold hover:scale-110 transform'>
|
||||
{category.name}
|
||||
</Link>
|
||||
);
|
||||
)
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
)
|
||||
}
|
||||
export default NavButtonGroup
|
||||
|
||||
@@ -47,7 +47,7 @@ const PaginationNumber = ({ page, totalPage }) => {
|
||||
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
function getPageElement(page, currentPage, pagePrefix) {
|
||||
@@ -66,7 +66,7 @@ function getPageElement(page, currentPage, pagePrefix) {
|
||||
{page}
|
||||
|
||||
</Link>)
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
function generatePages(pagePrefix, page, currentPage, totalPage) {
|
||||
|
||||
@@ -51,7 +51,7 @@ const PaginationSimple = ({ page, totalPage }) => {
|
||||
</button>
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
export default PaginationSimple
|
||||
|
||||
@@ -18,11 +18,9 @@ const SideBar = (props) => {
|
||||
|
||||
const defaultLinks = [
|
||||
{ icon: 'fas fa-home', name: locale.NAV.INDEX, to: '/' || '/', show: true },
|
||||
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: true },
|
||||
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_MATERY.MENU_ARCHIVE },
|
||||
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_MATERY.MENU_CATEGORY },
|
||||
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_MATERY.MENU_TAG }
|
||||
|
||||
]
|
||||
let links = [].concat(defaultLinks)
|
||||
if (customNav) {
|
||||
|
||||
@@ -14,7 +14,7 @@ const TagItemMiddle = ({ tag, selected = false }) => {
|
||||
{tag.name + (tag.count ? `(${tag.count})` : '')} </div>
|
||||
|
||||
</Link>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
export default TagItemMiddle
|
||||
|
||||
@@ -12,7 +12,7 @@ const TagItemMini = ({ tag, selected = false }) => {
|
||||
<div className='font-light'>{selected && <i className='mr-1 fa-tag'/>} {tag.name + (tag.count ? `(${tag.count})` : '')} </div>
|
||||
|
||||
</Link>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
export default TagItemMini
|
||||
|
||||
@@ -10,10 +10,10 @@ import CONFIG_MATERY from '../config_matery'
|
||||
* @constructor
|
||||
*/
|
||||
const TocDrawerButton = (props) => {
|
||||
const { locale } = useGlobal()
|
||||
if (!CONFIG_MATERY.WIDGET_TOC) {
|
||||
return <></>
|
||||
}
|
||||
const { locale } = useGlobal()
|
||||
return (<div onClick={props.onClick} className='py-2 px-3 cursor-pointer transform duration-200 flex justify-center items-center w-7 h-7 text-center' title={locale.POST.TOP} >
|
||||
<i className='fas fa-list-ol text-xs'/>
|
||||
</div>)
|
||||
|
||||
Reference in New Issue
Block a user