Skip to content

Commit 3207ece

Browse files
committed
✨ web/for-classes
1 parent dcc45e0 commit 3207ece

12 files changed

Lines changed: 4116 additions & 10 deletions

.cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"pandacss",
3030
"partytown",
3131
"rgba",
32+
"Sandpack",
3233
"syscat",
3334
"Syscat",
3435
"sysken",

astro.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default defineConfig({
9595
// },
9696
{
9797
label: "Web",
98-
link: "/textbook/web/for-classes",
98+
link: "/textbook/web/for-classes/html-structure-basic",
9999
icon: "document",
100100
items: [
101101
{
@@ -134,6 +134,7 @@ export default defineConfig({
134134
remarkPlugins: [
135135
[remarkMermaid, { themes: ["dark", "neutral"] }],
136136
[wikiLinkPlugin, { markdownFolder: "src/content/docs" }],
137+
// @ts-expect-error
137138
remarkSandpack,
138139
],
139140
rehypePlugins: [

bun.lockb

20.5 KB
Binary file not shown.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@astrojs/partytown": "^2.1.4",
2121
"@astrojs/react": "^4.3.0",
2222
"@astrojs/starlight": "^0.34.4",
23+
"@codesandbox/sandpack-react": "^2.20.0",
2324
"@fontsource-variable/inter": "^5.2.6",
2425
"@fontsource-variable/noto-sans-jp": "^5.2.6",
2526
"@iconify-json/material-symbols": "^1.2.28",
@@ -40,6 +41,7 @@
4041
"react": "^19.1.0",
4142
"react-dom": "^19.1.0",
4243
"rehype-external-links": "^3.0.0",
44+
"remark-sandpack": "^0.0.5",
4345
"remark-wiki-link-plus": "^1.1.1",
4446
"starlight-scroll-to-top": "^0.1.1",
4547
"starlight-sidebar-topics": "^0.6.0"

src/components/Sandpack.astro

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
import type { ComponentProps } from "react";
3+
import { Code } from "@astrojs/starlight/components";
4+
import { Sandpack as Sandpack_ } from "@codesandbox/sandpack-react";
5+
6+
type Props = ComponentProps<typeof Sandpack_>;
7+
8+
const props = Astro.props;
9+
---
10+
11+
<style>
12+
@keyframes fade-in {
13+
from {
14+
opacity: 0;
15+
}
16+
to {
17+
opacity: 1;
18+
}
19+
}
20+
21+
.sandpack {
22+
opacity: 0;
23+
animation: fade-in 300ms ease-in-out forwards;
24+
animation-delay: 2000ms;
25+
}
26+
</style>
27+
28+
<div class="not-content sandpack">
29+
<Fragment client:visible>
30+
<Sandpack_
31+
client:only="react"
32+
options={{
33+
showInlineErrors: true,
34+
editorHeight: 500,
35+
...props.options
36+
}}
37+
template="static"
38+
theme="light"
39+
{...props}
40+
>
41+
42+
<slot />
43+
44+
</Sandpack_>
45+
</Fragment>
46+
</div>
47+
48+
<div style="display: none;">
49+
<Code code="a" />
50+
</div>
51+

src/content/docs/textbook/web/for-classes/00--index.mdx

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)