File size: 1,277 Bytes
557ab38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
 * App — page composition. Hero, workbench, chapters, numbers, footer.
 * The 3D paper's state is lifted here so the hero can react to extraction.
 */
import { useCallback, useRef, useState } from "react";

import { CustomCursor } from "./components/CustomCursor";
import { ExtractSection } from "./components/ExtractSection";
import { Footer } from "./components/Footer";
import { Hero } from "./components/Hero";
import { HowItWorks } from "./components/HowItWorks";
import { Numbers } from "./components/Numbers";
import { TopNav } from "./components/TopNav";
import type { PaperState } from "./components/PaperScene";

export default function App() {
  const [paperState, setPaperState] = useState<PaperState>("idle");
  const heroCTA = useRef<() => void>(() => {});

  const bindExtract = useCallback((fn: () => void) => {
    heroCTA.current = fn;
  }, []);

  return (
    <div className="cursor-ink">
      <CustomCursor />
      <TopNav />
      <main>
        <Hero
          paperState={paperState}
          onCTAClick={() => heroCTA.current()}
        />
        <ExtractSection
          onStateChange={setPaperState}
          bindExtract={bindExtract}
        />
        <HowItWorks />
        <Numbers />
      </main>
      <Footer />
    </div>
  );
}