mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-29 15:10:06 +00:00
starter\magzine\gitbook 主题dashboard元素
This commit is contained in:
27
components/ui/dashboard/DashboardButton.js
Normal file
27
components/ui/dashboard/DashboardButton.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
/**
|
||||
* 跳转仪表盘的按钮
|
||||
* @returns
|
||||
*/
|
||||
export default function DashboardButton() {
|
||||
const { asPath } = useRouter()
|
||||
const enableDashboardButton = siteConfig('ENABLE_DASHBOARD_BUTTON', false)
|
||||
|
||||
if (!enableDashboardButton) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (asPath?.indexOf('/dashboard') === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
type='button'
|
||||
className='text-white bg-gray-800 hover:bg-gray-900 hover:ring-4 hover:ring-gray-300 focus:outline-none focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm px-5 py-2 me-2 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:border-gray-700'>
|
||||
<Link href='/dashboard'>仪表盘</Link>
|
||||
</button>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user