optimize theme

This commit is contained in:
tangly1024
2023-03-08 21:50:08 +08:00
parent 6033d08890
commit ff8ae782b7
20 changed files with 131 additions and 144 deletions

View File

@@ -10,7 +10,6 @@ import TopNav from './components/TopNav'
import { useGlobal } from '@/lib/global'
import PropTypes from 'prop-types'
import React from 'react'
import smoothscroll from 'smoothscroll-polyfill'
import CONFIG_NEXT from './config_next'
import Live2D from '@/components/Live2D'
import BLOG from '@/blog.config'
@@ -45,8 +44,6 @@ const LayoutBase = (props) => {
}
React.useEffect(() => {
smoothscroll.polyfill()
// facebook messenger 插件需要调整右下角悬浮按钮的高度
const fb = document.getElementsByClassName('fb-customerchat')
if (fb.length === 0) {

View File

@@ -1,5 +1,4 @@
import React, { useEffect, useState } from 'react'
import smoothscroll from 'smoothscroll-polyfill'
import CONFIG_NEXT from '../config_next'
/**
@@ -11,12 +10,18 @@ import CONFIG_NEXT from '../config_next'
* @constructor
*/
const JumpToBottomButton = ({ showPercent = false }) => {
const [show, switchShow] = useState(false)
const [percent, changePercent] = useState(0)
useEffect(() => {
document.addEventListener('scroll', scrollListener)
return () => document.removeEventListener('scroll', scrollListener)
}, [show])
if (!CONFIG_NEXT.WIDGET_TO_BOTTOM) {
return <></>
}
const [show, switchShow] = useState(false)
const [percent, changePercent] = useState(0)
const scrollListener = () => {
const targetRef = document.getElementById('wrapper')
const clientHeight = targetRef?.clientHeight
@@ -36,13 +41,6 @@ const JumpToBottomButton = ({ showPercent = false }) => {
window.scrollTo({ top: targetRef.clientHeight, behavior: 'smooth' })
}
useEffect(() => {
smoothscroll.polyfill()
document.addEventListener('scroll', scrollListener)
return () => document.removeEventListener('scroll', scrollListener)
}, [show])
return (<div className='flex space-x-1 transform hover:scale-105 duration-200 py-2 px-3' onClick={scrollToBottom} >
<div className='dark:text-gray-200' >
<i className='fas fa-arrow-down' />