forked from tangly1024/NotionNext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
589a4b8
commit a4d8374
Showing
11 changed files
with
126 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useGlobal } from '@/lib/global' | ||
import { saveDarkModeToCookies } from '@/lib/theme' | ||
import CONFIG_HEXO from '../config_hexo' | ||
|
||
export default function FloatDarkModeButton () { | ||
if (!CONFIG_HEXO.WIDGET_DARK_MODE) { | ||
return <></> | ||
} | ||
|
||
const { isDarkMode, updateDarkMode } = useGlobal() | ||
// 用户手动设置主题 | ||
const handleChangeDarkMode = () => { | ||
const newStatus = !isDarkMode | ||
saveDarkModeToCookies(newStatus) | ||
updateDarkMode(newStatus) | ||
const htmlElement = document.getElementsByTagName('html')[0] | ||
htmlElement.classList?.remove(newStatus ? 'light' : 'dark') | ||
htmlElement.classList?.add(newStatus ? 'dark' : 'light') | ||
} | ||
|
||
return ( | ||
<div | ||
onClick={handleChangeDarkMode} | ||
className={'justify-center items-center text-white bg-blue-400 w-7 h-7 text-center transform hover:scale-105 duration-200' | ||
} | ||
> | ||
<i id="darkModeButton" className={`${isDarkMode ? 'fa-sun' : 'fa-moon'} fas text-xs`}/> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react' | ||
import CONFIG_HEXO from '../config_hexo' | ||
|
||
/** | ||
* 跳转到评论区 | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
const JumpToCommentButton = () => { | ||
if (!CONFIG_HEXO.WIDGET_TO_COMMENT) { | ||
return <></> | ||
} | ||
function navToComment () { | ||
const commentElement = document.getElementById('comment') | ||
if (commentElement) { | ||
commentElement?.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' }) | ||
} | ||
} | ||
|
||
return (<div className='flex space-x-1 items-center justify-center transform hover:scale-105 duration-200 text-white bg-blue-400 w-7 h-7 text-center' onClick={navToComment} > | ||
<i className='fas fa-comment text-xs' /> | ||
</div>) | ||
} | ||
|
||
export default JumpToCommentButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react' | ||
import Link from 'next/link' | ||
import { useGlobal } from '@/lib/global' | ||
import CONFIG_HEXO from '../config_hexo' | ||
|
||
const MenuButtonGroupTop = (props) => { | ||
const { customNav } = props | ||
const { locale } = useGlobal() | ||
|
||
let links = [ | ||
{ icon: 'fas fa-archive', name: locale.COMMON.ARTICLE, to: '/archive', show: CONFIG_HEXO.MENU_ARCHIVE }, | ||
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_HEXO.MENU_CATEGORY }, | ||
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_HEXO.MENU_TAG } | ||
] | ||
|
||
if (customNav) { | ||
links = links.concat(customNav) | ||
} | ||
|
||
return <nav id='nav' className='leading-8 flex justify-center font-sans w-full'> | ||
{links.map(link => { | ||
if (link.show) { | ||
return <Link key={`${link.to}`} title={link.to} href={link.to} > | ||
<a className={'py-1.5 my-1 px-2 duration-300 text-base justify-center items-center cursor-pointer'} > | ||
<div className='w-full flex dark:text-white text-sm items-center justify-center hover:scale-105 duration-200 transform'> | ||
<i className={`${link.icon} mr-1`}/> | ||
<div className='text-center'>{link.name}</div> | ||
</div> | ||
</a> | ||
</Link> | ||
} else { | ||
return null | ||
} | ||
})} | ||
</nav> | ||
} | ||
export default MenuButtonGroupTop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters