From 4203fee1c9c69b6020dd1c10ad2d9b42844bfd9e Mon Sep 17 00:00:00 2001 From: akash Date: Wed, 13 Aug 2025 03:23:49 -0700 Subject: [PATCH] Scroll to top added --- components/common/BootstrapInit.jsx | 13 +++++++++++++ components/common/ClientLayout.tsx | 26 +++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 components/common/BootstrapInit.jsx diff --git a/components/common/BootstrapInit.jsx b/components/common/BootstrapInit.jsx new file mode 100644 index 0000000..76b2313 --- /dev/null +++ b/components/common/BootstrapInit.jsx @@ -0,0 +1,13 @@ +"use client"; + +import { useEffect } from "react"; + +export default function BootstrapInit() { + useEffect(() => { + if (typeof window !== "undefined") { + require("bootstrap/dist/js/bootstrap.bundle.min.js"); + } + }, []); + + return null; +} diff --git a/components/common/ClientLayout.tsx b/components/common/ClientLayout.tsx index 60f5a23..9dc84ac 100644 --- a/components/common/ClientLayout.tsx +++ b/components/common/ClientLayout.tsx @@ -3,6 +3,7 @@ import React, { useEffect, useState } from 'react'; import { usePathname } from 'next/navigation'; import Preloader from '@/app/loading'; +import ScrollToTop from 'react-scroll-to-top'; export default function ClientLayout({ children }: { children: React.ReactNode }) { const pathname = usePathname(); @@ -31,7 +32,30 @@ export default function ClientLayout({ children }: { children: React.ReactNode } return ( <> {isLoading && } - {!isLoading && children} + {!isLoading && ( + <> + {children} + + {/* Scroll to Top Button */} + + + )} ); }