feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334)
This commit is contained in:
committed by
GitHub
parent
d6b1ad1ccd
commit
40de54b010
20
packages/admin-ui/ui/src/hooks/use-scroll.ts
Normal file
20
packages/admin-ui/ui/src/hooks/use-scroll.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useState } from "react"
|
||||
|
||||
type useScrollProps = {
|
||||
threshold?: number
|
||||
}
|
||||
|
||||
export const useScroll = ({ threshold = 0 }: useScrollProps) => {
|
||||
const [isScrolled, setIsScrolled] = useState(false)
|
||||
|
||||
const scrollListener = e => {
|
||||
const currentScrollY = e.target.scrollTop
|
||||
if (currentScrollY > threshold) {
|
||||
setIsScrolled(true)
|
||||
} else {
|
||||
setIsScrolled(false)
|
||||
}
|
||||
}
|
||||
|
||||
return { isScrolled, scrollListener }
|
||||
}
|
||||
Reference in New Issue
Block a user