Converted the css to sass

This commit is contained in:
2023-08-30 19:15:19 +02:00
parent 3f3387b1d1
commit 89b6d7eeb7
9 changed files with 81 additions and 66 deletions

View File

@@ -15,13 +15,13 @@ export const Anchoring = (props: AnchoringProps) => {
const handleScrollOpacity = () => {
const scrollTop = window.scrollY || window.pageYOffset;
const elementHeight = anchoringRef.current.clientHeight;
const elementHeight = anchoringRef.current?.clientHeight ? anchoringRef.current.clientHeight : 1;
const newOpacity = (elementHeight - scrollTop) / elementHeight;
setOpacity(newOpacity);
};
const handleScrollClick = () => {
anchoringRef.current.scrollIntoView({
anchoringRef?.current?.scrollIntoView({
behavior: "smooth",
block: "start"
});