forked from webpack/webpack.js.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplash.jsx
More file actions
111 lines (93 loc) · 3.43 KB
/
Splash.jsx
File metadata and controls
111 lines (93 loc) · 3.43 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Import External Dependencies
import { Suspense, lazy, useState, useSyncExternalStore } from "react";
// Import Components
import SplashContent from "../../content/index.mdx";
import Container from "../Container/Container.jsx";
import Markdown from "../Markdown/Markdown.jsx";
import { PlaceholderComponent } from "../Placeholder/Placeholder.jsx";
import SplashViz from "../SplashViz/SplashViz.jsx";
const Support = lazy(() => import("../Support/Support.jsx"));
const SponsorsPlaceholder = () => (
<>
<h2>Latest Sponsors</h2>
<PlaceholderComponent />
<h2>Platinum Sponsors</h2>
<PlaceholderComponent />
<h2>Gold Sponsors</h2>
<PlaceholderComponent />
<h2>Silver Sponsors</h2>
<PlaceholderComponent />
<h2>Bronze Sponsors</h2>
<PlaceholderComponent />
<h2>Backers</h2>
<PlaceholderComponent />
</>
);
const Splash = () => {
const [supportType, setSupportType] = useState(() =>
typeof window !== "undefined"
? Math.random() < 0.33
? "monthly"
: "total"
: "total",
);
const showSponsors = useSyncExternalStore(
() => () => {},
() => true,
() => false,
);
return (
<div className="relative overflow-hidden [&_h1]:justify-center [&_h2]:justify-center">
<SplashViz />
<div className="relative text-center bg-[#f3f3f3] dark:bg-[#202020] page__content [&_p]:my-[1em]! [&_p]:mx-auto! [&_p]:max-w-200 [&_pre]:text-left [&_.icon-link]:hidden">
<Container className="py-[1em] px-[1em] md:px-[1.5em]">
<Markdown>
<SplashContent />
</Markdown>
</Container>
</div>
<div className="relative text-center page__content [&_p]:my-[1em]! [&_p]:mx-auto! [&_p]:max-w-200 [&_pre]:text-left [&_.icon-link]:hidden">
<Container className="py-[5em] px-[1em] md:px-[1.5em]">
<Markdown>
<h1 id="sponsors">Support the Team</h1>
<p>
Through contributions, donations, and sponsorship, you allow
webpack to thrive. Your donations directly support office hours,
continued enhancements, and most importantly, great documentation
and learning material!
</p>
{showSponsors ? (
<Suspense fallback={<SponsorsPlaceholder />}>
<p>
<label htmlFor="support-type">
<input
id="support-type"
type="checkbox"
checked={supportType === "monthly"}
onChange={(event) =>
setSupportType(
event.target.checked ? "monthly" : "total",
)
}
/>
Show sponsors by their average monthly amount of sponsoring
in the last year.
</label>
</p>
<Support type={supportType} rank="latest" />
<Support type={supportType} rank="platinum" />
<Support type={supportType} rank="gold" />
<Support type={supportType} rank="silver" />
<Support type={supportType} rank="bronze" />
<Support type={supportType} rank="backer" />
</Suspense>
) : (
<SponsorsPlaceholder />
)}
</Markdown>
</Container>
</div>
</div>
);
};
export default Splash;