MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / LandingPage

Function LandingPage

src/pages/LandingPage.jsx:16–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14const MIN_LOADER_MS = 800;
15
16const LandingPage = () => {
17 useScrollToTop();
18 const [loaded, setLoaded] = useState(false);
19 const [hiding, setHiding] = useState(false);
20
21 const reveal = useCallback(() => {
22 setHiding(true);
23 // after the loader fade-out finishes, mark fully loaded & unlock scroll
24 setTimeout(() => setLoaded(true), 600);
25 }, []);
26
27 useLayoutEffect(() => {
28 if (loaded) return;
29 document.documentElement.style.overflow = 'hidden';
30 document.body.style.overflow = 'hidden';
31 return () => {
32 document.documentElement.style.overflow = '';
33 document.body.style.overflow = '';
34 };
35 }, [loaded]);
36
37 useEffect(() => {
38 const start = Date.now();
39
40 document.fonts.ready.then(() => {
41 const elapsed = Date.now() - start;
42 const remaining = Math.max(0, MIN_LOADER_MS - elapsed);
43 setTimeout(reveal, remaining);
44 });
45 }, [reveal]);
46
47 return (
48 <>
49 {!loaded && <LandingLoader hiding={hiding} />}
50 <section className={`landing-wrapper no-side-fades${loaded ? ' ln-loaded' : ' ln-loading'}`}>
51 <title>React Bits - Animated UI Components For React</title>
52
53 <Navbar />
54 <Hero />
55 <Features />
56 <Testimonials />
57 <LiveDemo />
58 <QuickStart />
59 <Sponsors />
60 <CTA />
61 <Footer />
62 </section>
63 </>
64 );
65};
66
67export default LandingPage;

Callers

nothing calls this directly

Calls 1

useScrollToTopFunction · 0.85

Tested by

no test coverage detected