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.
Merge branch 'main' of https://github.com/tangly1024/NotionNext
- Loading branch information
Showing
15 changed files
with
311 additions
and
77 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
21 changes: 14 additions & 7 deletions
21
...es/hexo/components/JumpToCommentButton.js → ...es/hexo/components/ButtonJumpToComment.js
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 |
---|---|---|
@@ -1,29 +1,36 @@ | ||
import CONFIG from '../config' | ||
import { siteConfig } from '@/lib/config' | ||
import CONFIG from '../config' | ||
|
||
/** | ||
* 跳转到评论区 | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
const JumpToCommentButton = () => { | ||
const ButtonJumpToComment = () => { | ||
if (!siteConfig('HEXO_WIDGET_TO_COMMENT', null, CONFIG)) { | ||
return <></> | ||
} | ||
|
||
function navToComment() { | ||
if (document.getElementById('comment')) { | ||
window.scrollTo({ top: document.getElementById('comment').offsetTop, behavior: 'smooth' }) | ||
window.scrollTo({ | ||
top: document.getElementById('comment').offsetTop, | ||
behavior: 'smooth' | ||
}) | ||
} | ||
// 兼容性不好 | ||
// 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 w-7 h-7 text-center' onClick={navToComment} > | ||
<i className='fas fa-comment text-xs' /> | ||
</div>) | ||
return ( | ||
<div | ||
className='flex space-x-1 items-center justify-center transform hover:scale-105 duration-200 w-7 h-7 text-center' | ||
onClick={navToComment}> | ||
<i className='fas fa-comment text-xs' /> | ||
</div> | ||
) | ||
} | ||
|
||
export default JumpToCommentButton | ||
export default ButtonJumpToComment |
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,29 @@ | ||
import { siteConfig } from '@/lib/config' | ||
import { useGlobal } from '@/lib/global' | ||
import { useRouter } from 'next/router' | ||
|
||
/** | ||
* 随机跳转到一个文章 | ||
*/ | ||
export default function ButtonRandomPost(props) { | ||
const { latestPosts } = props | ||
const router = useRouter() | ||
const { locale } = useGlobal() | ||
/** | ||
* 随机跳转文章 | ||
*/ | ||
function handleClick() { | ||
const randomIndex = Math.floor(Math.random() * latestPosts.length) | ||
const randomPost = latestPosts[randomIndex] | ||
router.push(`${siteConfig('SUB_PATH', '')}/${randomPost?.slug}`) | ||
} | ||
|
||
return ( | ||
<div | ||
title={locale.MENU.WALK_AROUND} | ||
className='cursor-pointer hover:bg-black hover:bg-opacity-10 rounded-full w-10 h-10 flex justify-center items-center duration-200 transition-all' | ||
onClick={handleClick}> | ||
<i className='fa-solid fa-podcast'></i> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { siteConfig } from '@/lib/config' | ||
import { useGlobal } from '@/lib/global' | ||
import { useRouter } from 'next/router' | ||
|
||
/** | ||
* 随机跳转到一个文章 | ||
*/ | ||
export default function ButtonRandomPostMini(props) { | ||
const { latestPosts } = props | ||
const router = useRouter() | ||
const { locale } = useGlobal() | ||
/** | ||
* 随机跳转文章 | ||
*/ | ||
function handleClick() { | ||
const randomIndex = Math.floor(Math.random() * latestPosts.length) | ||
const randomPost = latestPosts[randomIndex] | ||
router.push(`${siteConfig('SUB_PATH', '')}/${randomPost?.slug}`) | ||
} | ||
|
||
return ( | ||
<div | ||
title={locale.MENU.WALK_AROUND} | ||
className='flex space-x-1 items-center justify-center transform hover:scale-105 duration-200 w-7 h-7 text-center' | ||
onClick={handleClick}> | ||
<i className='fa-solid fa-podcast'></i> | ||
</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
Oops, something went wrong.