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
70cc96d
commit aa284a5
Showing
9 changed files
with
135 additions
and
68 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
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,26 @@ | ||
import BLOG from '@/blog.config' | ||
import { useGlobal } from '@/lib/global' | ||
import { useRouter } from 'next/router' | ||
|
||
/** | ||
* 随机跳转到一个文章 | ||
*/ | ||
export default function RandomPostButton(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(`${BLOG.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,28 @@ | ||
import BLOG from '@/blog.config' | ||
import { useGlobal } from '@/lib/global' | ||
import { useRouter } from 'next/router' | ||
import { useNobeliumGlobal } from '..' | ||
|
||
/** | ||
* 搜索按钮 | ||
* @returns | ||
*/ | ||
export default function SearchButton(props) { | ||
const { locale } = useGlobal() | ||
const { searchModal } = useNobeliumGlobal() | ||
const router = useRouter() | ||
|
||
function handleSearch() { | ||
if (BLOG.ALGOLIA_APP_ID) { | ||
searchModal.current.openSearch() | ||
} else { | ||
router.push('/search') | ||
} | ||
} | ||
|
||
return <> | ||
<div onClick={handleSearch} title={locale.NAV.SEARCH} alt={locale.NAV.SEARCH} 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'> | ||
<i title={locale.NAV.SEARCH} className="fa-solid fa-magnifying-glass" /> | ||
</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 |
---|---|---|
@@ -1,13 +1,17 @@ | ||
const CONFIG = { | ||
|
||
// 菜单配置 | ||
NAV_NOTION_ICON: true, // 是否读取Notion图标作为站点头像 ; 否则默认显示黑色SVG方块 | ||
|
||
// 特殊菜单 | ||
MENU_RANDOM_POST: true, // 是否显示随机跳转文章按钮 | ||
MENU_SEARCH_BUTTON: true, // 是否显示搜索按钮,该按钮支持Algolia搜索 | ||
|
||
// 默认菜单配置 (开启自定义菜单后,以下配置则失效,请在Notion中自行配置菜单) | ||
MENU_CATEGORY: false, // 显示分类 | ||
MENU_TAG: true, // 显示标签 | ||
MENU_ARCHIVE: false, // 显示归档 | ||
MENU_SEARCH: true, // 显示搜索 | ||
MENU_RSS: false, // 显示订阅 | ||
|
||
NAV_NOTION_ICON: true // 是否读取Notion图标作为站点头像 | ||
MENU_RSS: false // 显示订阅 | ||
|
||
} | ||
export default CONFIG |
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