From 7f40af00cea99afed8e8ec33301bce811607f076 Mon Sep 17 00:00:00 2001 From: Jack Zhao Date: Sat, 4 Nov 2023 15:31:30 +0000 Subject: [PATCH] react example --- docs/astro.config.mjs | 3 +- docs/package.json | 2 +- docs/src/components/PySandboxExample.astro | 8 ++-- docs/src/content/docs/guides/comparison.md | 10 +++-- .../docs/guides/{examples.mdx => demo.mdx} | 4 +- docs/src/content/docs/guides/installation.md | 2 +- docs/src/content/docs/guides/introduction.md | 4 +- docs/src/content/docs/guides/react.md | 38 +++++++++++++++++++ docs/src/content/docs/index.mdx | 8 ++-- docs/src/content/docs/references/index.md | 2 +- 10 files changed, 62 insertions(+), 19 deletions(-) rename docs/src/content/docs/guides/{examples.mdx => demo.mdx} (95%) create mode 100644 docs/src/content/docs/guides/react.md diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 1665951..d4dff68 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -26,8 +26,9 @@ export default defineConfig({ // Each item here is one entry in the navigation menu. { label: "Introduction", link: "guides/introduction" }, { label: "Comparison", link: "guides/comparison" }, - { label: "Examples", link: "guides/examples" }, + { label: "Demo", link: "guides/demo" }, { label: "Installation", link: "guides/installation" }, + { label: "React Integration", link: "guides/react" }, ], }, { label: "Documentation", autogenerate: { directory: "references" } }, diff --git a/docs/package.json b/docs/package.json index 2ccc46a..d9c8533 100644 --- a/docs/package.json +++ b/docs/package.json @@ -11,7 +11,7 @@ "build": "astro build", "preview": "astro preview", "astro": "astro", - "format": "prettier -w src src/**/*.astro *.mjs *.js *.json *.css" + "format": "prettier -w src src/**/*.astro *.mjs *.js *.json" }, "dependencies": { "@astrojs/starlight": "^0.10.0", diff --git a/docs/src/components/PySandboxExample.astro b/docs/src/components/PySandboxExample.astro index 6319cb7..6b960c8 100644 --- a/docs/src/components/PySandboxExample.astro +++ b/docs/src/components/PySandboxExample.astro @@ -20,14 +20,14 @@ const { code, target, worker, restricted } = Astro.props; } -
- Output:
-
-
+
+ Output:
+
+ ` and `` tags. +[PyScript](https://pyscript.net) is great for configuring a single html page to run Python code as well as providing acess to DOM through its `pyweb` API. Python code in `PyScript` is defined in custom script tags such as ``. If you are using a JS web-framework (e.g. a React-based framework) to build your web application, you may find `PySandbox` easier to use with its pure JS invocation without needing to rely on `