mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-18 07:26:48 +00:00
gitbook-jump-to-top
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import React from 'react'
|
||||
import CONFIG_GITBOOK from '../config_gitbook'
|
||||
|
||||
/**
|
||||
* 跳转到网页顶部
|
||||
@@ -11,16 +8,17 @@ import CONFIG_GITBOOK from '../config_gitbook'
|
||||
* @constructor
|
||||
*/
|
||||
const JumpToTopButton = ({ showPercent = false, percent, className }) => {
|
||||
const { locale } = useGlobal()
|
||||
if (!CONFIG_GITBOOK.WIDGET_TO_TOP) {
|
||||
return <></>
|
||||
}
|
||||
return (<div className={'flex space-x-1 items-center cursor-pointer w-full justify-center ' + className } onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })} >
|
||||
<div title={locale.POST.TOP} >
|
||||
<i className='fas fa-arrow-up'/>
|
||||
</div>
|
||||
{showPercent && (<div className='text-xs dark:text-gray-200 block lg:hidden'>{percent}%</div>)}
|
||||
</div>)
|
||||
return (
|
||||
<div
|
||||
id="jump-to-top"
|
||||
data-aos="fade-up"
|
||||
data-aos-duration="300"
|
||||
data-aos-once="false"
|
||||
data-aos-anchor-placement="top-center"
|
||||
className='fixed xl:right-80 right-2 mr-10 bottom-24 z-20'>
|
||||
<i className='fas fa-chevron-up cursor-pointer p-2 rounded-full border bg-white dark:bg-hexo-black-gray' onClick={() => { window.scrollTo({ top: 0, behavior: 'smooth' }) }} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default JumpToTopButton
|
||||
|
||||
Reference in New Issue
Block a user