-
Notifications
You must be signed in to change notification settings - Fork 3
演習問題にSandpackによる実行環境を追加 #889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
98512c9
d66919b
7e8a5fa
24c10dc
a21741e
1f48692
25ed472
25a0a33
180a1df
2d52afd
3878e6b
4b04494
8469084
afaa34c
27a8ecf
756c1e1
97064c8
12432c5
8a10b37
bf57164
cd708f8
5d581e2
5da31d5
1bdb2c0
a70b65f
8d96eb9
2d4b004
6f1f7ff
8b464f0
a100914
620fd09
7d017aa
cd53d86
5aee802
9215bc0
d9eff1f
823952f
0cf2a23
07ee71e
1b168b7
e4bbfe5
d75f081
d7b1cd0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,14 @@ | |
| title: 関数 | ||
| --- | ||
|
|
||
| import { Sandpack } from "@codesandbox/sandpack-react"; | ||
| import returnValueVideo from "./return-value.mp4"; | ||
| import multiplyHtml from "!!raw-loader!./_samples/multiply/index.html"; | ||
| import multiplyJs from "!!raw-loader!./_samples/multiply/script.js"; | ||
| import maxHtml from "!!raw-loader!./_samples/max/index.html"; | ||
| import maxJs from "!!raw-loader!./_samples/max/script.js"; | ||
| import mobilePhoneBillHtml from "!!raw-loader!./_samples/mobile-phone-bill/index.html"; | ||
| import mobilePhoneBillJs from "!!raw-loader!./_samples/mobile-phone-bill/script.js"; | ||
|
|
||
| ## 処理の共通化 | ||
|
|
||
|
|
@@ -97,7 +104,16 @@ function multiply(a, b) { | |
| document.write(multiply(3, 4)); | ||
| ``` | ||
|
|
||
| <ViewSource url={import.meta.url} path="_samples/multiply" /> | ||
| <Sandpack | ||
| template="static" | ||
| files={{ | ||
| "/index.html": multiplyHtml, | ||
| "/script.js": multiplyJs, | ||
| }} | ||
| options={{ | ||
| activeFile: "/script.js", | ||
| }} | ||
| /> | ||
|
|
||
| </Answer> | ||
|
|
||
|
|
@@ -187,7 +203,16 @@ function max(a, b) { | |
| } | ||
| ``` | ||
|
|
||
| <ViewSource url={import.meta.url} path="_samples/max" /> | ||
| <Sandpack | ||
| template="static" | ||
| files={{ | ||
| "/index.html": maxHtml, | ||
| "/script.js": maxJs, | ||
| }} | ||
| options={{ | ||
| activeFile: "/script.js", | ||
| }} | ||
| /> | ||
|
|
||
| :::note | ||
|
|
||
|
|
@@ -202,8 +227,6 @@ function max(a, b) { | |
| } | ||
| ``` | ||
|
|
||
| <ViewSource url={import.meta.url} path="_samples/max-no-else" /> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ut.code(); Learnではどうして、2つとの同じViewSourceなのに2つ置いてあるのか。 |
||
|
|
||
| ::: | ||
|
|
||
| </Answer> | ||
|
|
@@ -238,6 +261,15 @@ function calculateCost(monthlyDataUsage) { | |
| document.write(calculateCost(3.5)); | ||
| ``` | ||
|
|
||
| <ViewSource url={import.meta.url} path="_samples/mobile-phone-bill" /> | ||
| <Sandpack | ||
| template="static" | ||
| files={{ | ||
| "/index.html": mobilePhoneBillHtml, | ||
| "/script.js": mobilePhoneBillJs, | ||
| }} | ||
| options={{ | ||
| activeFile: "/script.js", | ||
| }} | ||
| /> | ||
|
|
||
| </Answer> | ||
Uh oh!
There was an error while loading. Please reload this page.