upstream #1
@ -1,12 +1,10 @@
|
|||||||
import siteMetadata from '@/data/siteMetadata'
|
import siteMetadata from '@/data/siteMetadata'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import smoothscroll from 'smoothscroll-polyfill'
|
|
||||||
|
|
||||||
const ScrollTopAndComment = () => {
|
const ScrollTopAndComment = () => {
|
||||||
const [show, setShow] = useState(false)
|
const [show, setShow] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
smoothscroll.polyfill()
|
|
||||||
const handleWindowScroll = () => {
|
const handleWindowScroll = () => {
|
||||||
if (window.scrollY > 50) setShow(true)
|
if (window.scrollY > 50) setShow(true)
|
||||||
else setShow(false)
|
else setShow(false)
|
||||||
@ -17,7 +15,7 @@ const ScrollTopAndComment = () => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const handleScrollTop = () => {
|
const handleScrollTop = () => {
|
||||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
window.scrollTo({ top: 0 })
|
||||||
}
|
}
|
||||||
const handleScrollToComment = () => {
|
const handleScrollToComment = () => {
|
||||||
document.getElementById('comment').scrollIntoView()
|
document.getElementById('comment').scrollIntoView()
|
||||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -9405,11 +9405,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"smoothscroll-polyfill": {
|
|
||||||
"version": "0.4.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/smoothscroll-polyfill/-/smoothscroll-polyfill-0.4.4.tgz",
|
|
||||||
"integrity": "sha512-TK5ZA9U5RqCwMpfoMq/l1mrH0JAR7y7KRvOBx0n2869aLxch+gT9GhN3yUfjiw+d/DiF1mKo14+hd62JyMmoBg=="
|
|
||||||
},
|
|
||||||
"socket.io": {
|
"socket.io": {
|
||||||
"version": "4.4.0",
|
"version": "4.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.4.0.tgz",
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
"remark-gfm": "^3.0.1",
|
"remark-gfm": "^3.0.1",
|
||||||
"remark-math": "^5.1.1",
|
"remark-math": "^5.1.1",
|
||||||
"sharp": "^0.28.3",
|
"sharp": "^0.28.3",
|
||||||
"smoothscroll-polyfill": "^0.4.4",
|
|
||||||
"tailwindcss": "^3.0.23",
|
"tailwindcss": "^3.0.23",
|
||||||
"unist-util-visit": "^4.0.0"
|
"unist-util-visit": "^4.0.0"
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user