Scroll to top added

This commit is contained in:
akash 2025-08-13 03:23:49 -07:00
parent 76e8721d2a
commit 4203fee1c9
2 changed files with 38 additions and 1 deletions

View File

@ -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;
}

View File

@ -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 && <Preloader fadeOut={fadeOut} />}
{!isLoading && children}
{!isLoading && (
<>
{children}
{/* Scroll to Top Button */}
<ScrollToTop
smooth
color="#ffffffff"
style={{
background: '#ed1b24',
borderRadius: '50%',
boxShadow: '0 4px 6px rgba(0,0,0,0.2)',
padding: '8px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
svgPath="M222.138,91.475l-89.6-89.6c-2.5-2.5-6.551-2.5-9.051,0l-89.6,89.6c-2.5,2.5-2.5,6.551,0,9.051
s6.744,2.5,9.244,0L122,21.85V249.6c0,3.535,2.466,6.4,6,6.4s6-2.865,6-6.4V21.85l78.881,78.676
c1.25,1.25,2.992,1.875,4.629,1.875s3.326-0.625,4.576-1.875
C224.586,98.025,224.638,93.975,222.138,91.475z"
/>
</>
)}
</>
);
}