From b4312693c24fca7d592bf677ca61d46a179784ac Mon Sep 17 00:00:00 2001 From: nemanjam Date: Wed, 17 Jul 2024 12:00:58 +0200 Subject: [PATCH] fix debounce scroll to top --- src/components/react/ScrollToTop.tsx | 3 ++- src/content/post/2024-01-20-example-article-4.mdx | 2 ++ src/pages/blog/[slug].astro | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/react/ScrollToTop.tsx b/src/components/react/ScrollToTop.tsx index 18428e7..5579da1 100644 --- a/src/components/react/ScrollToTop.tsx +++ b/src/components/react/ScrollToTop.tsx @@ -55,7 +55,8 @@ const ScrollToTop: React.FC = ({ children }) => { } }; - const debouncedCallback = debounce(callback, 500); + // bellow 200 or it will break again + const debouncedCallback = debounce(callback, 100); const intersect = new IntersectionObserver(debouncedCallback); if (topRef.current) intersect.observe(topRef.current); diff --git a/src/content/post/2024-01-20-example-article-4.mdx b/src/content/post/2024-01-20-example-article-4.mdx index c034400..ec8b131 100644 --- a/src/content/post/2024-01-20-example-article-4.mdx +++ b/src/content/post/2024-01-20-example-article-4.mdx @@ -28,6 +28,8 @@ import RiverImage from '../../content/post/_images/2024-01-20-example-article-4/ Ut exercitation occaecat in velit [nulla aliqua](#) eiusmod laboris ex. Officia dolore ipsum aliqua irure qui non ea elit veniam aute ex incididunt. Elit incididunt dolor velit velit magna. Nulla occaecat ut dolore ullamco amet aliqua laborum velit cillum. +This is tip alert + Nostrud irure nulla enim in commodo duis anim veniam irure fugiat cillum. Aliqua velit incididunt id eu aute labore. Nulla sint commodo voluptate labore `elit laboris` in anim labore eu qui commodo.Excepteur ea aliquip proident ea mollit nostrud excepteur et. Exercitation veniam officia `ullamco enim` officia fugiat pariatur anim mollit duis proident. Minim officia deserunt Lorem culpa occaecat adipisicing officia do laborum est ex do. ```ts title="example.ts" caption="Nulla occaecat ut dolore ullamco amet aliqua laborum velit cillum." diff --git a/src/pages/blog/[slug].astro b/src/pages/blog/[slug].astro index 9bd0872..cea701f 100644 --- a/src/pages/blog/[slug].astro +++ b/src/pages/blog/[slug].astro @@ -104,7 +104,7 @@ const metadata: Metadata = { title, description, image }; { description && ( -

{description}

+

{description}

) }