-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathApp.tsx
More file actions
56 lines (47 loc) · 1.22 KB
/
App.tsx
File metadata and controls
56 lines (47 loc) · 1.22 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
import type { ReactNode } from "react";
const topics = ["JSX", "components", "reconciliation", "hooks"];
function Badge({ tone }: { tone: "new" | "core" }) {
return <span data-tone={tone}>{tone.toUpperCase()}</span>;
}
function Card({
title,
highlight = false,
children,
}: {
title: string;
highlight?: boolean;
children: ReactNode;
}) {
return (
<article className={highlight ? "card card--highlight" : "card"}>
<header>
<h2>{title}</h2>
<Badge tone="core" />
</header>
<div>{children}</div>
</article>
);
}
function App() {
const isLearning = true;
const score = 3;
return (
<>
<section id="ast-playground" data-mode="explore">
<h1>{"Understanding React through the AST"}</h1>
<p>{isLearning ? "Tracing JSX nodes" : "Waiting for examples"}</p>
<Card title="Concepts" highlight={score > 2}>
<ul>
{topics.map((topic, index) => (
<li key={topic}>
<strong>{index + 1}.</strong> {topic}
</li>
))}
</ul>
</Card>
{isLearning && <footer>Open src/App.tsx and change this tree.</footer>}
</section>
</>
);
}
export default App;