Skip to content

Commit

Permalink
fix debounce scroll to top
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanjam committed Jul 17, 2024
1 parent 0858a9a commit b431269
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/react/ScrollToTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const ScrollToTop: React.FC<Props> = ({ 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);
Expand Down
2 changes: 2 additions & 0 deletions src/content/post/2024-01-20-example-article-4.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<Alert variant="tip">This is tip alert</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."
Expand Down
2 changes: 1 addition & 1 deletion src/pages/blog/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const metadata: Metadata = { title, description, image };

{
description && (
<p class="font-normal text-captions text-xl md:text-2xl mb-6 md:mb-8">{description}</p>
<p class="font-normal text-content text-xl md:text-2xl mb-6 md:mb-8">{description}</p>
)
}

Expand Down

0 comments on commit b431269

Please sign in to comment.