playground: better error display

This commit is contained in:
Moritz Hölting 2024-08-15 21:06:36 +02:00
parent 532e371e7e
commit 75aebd9156
3 changed files with 33 additions and 15 deletions

View File

@ -23,7 +23,7 @@ jobs:
- name: Install Rust - name: Install Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
targets: wasm32-unknown-unknown targets: wasm32-unknown-unknown
- name: Install wasm-bindgen-cli - name: Install wasm-bindgen-cli
uses: jetli/wasm-bindgen-action@v0.2.0 uses: jetli/wasm-bindgen-action@v0.2.0
- name: Install, build, and upload your site output - name: Install, build, and upload your site output

View File

@ -18,25 +18,16 @@ export default function ErrorDisplay({
<Dialog open={error !== null} onClose={() => setError(null)}> <Dialog open={error !== null} onClose={() => setError(null)}>
<DialogTitle>{lang.title}</DialogTitle> <DialogTitle>{lang.title}</DialogTitle>
<DialogContent> <DialogContent>
<div <div className="error-terminal-display">
style={{
backgroundColor: "black",
padding: "15px",
borderRadius: "15px",
fontSize: "1.2em",
}}
>
<code <code
style={{
whiteSpace: "break-spaces",
fontFamily: "monospace",
}}
dangerouslySetInnerHTML={{ __html: error ?? "" }} dangerouslySetInnerHTML={{ __html: error ?? "" }}
></code> ></code>
</div> </div>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<Button onClick={() => setError(null)}>{lang.buttons.close}</Button> <Button onClick={() => setError(null)}>
{lang.buttons.close}
</Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
); );

View File

@ -43,3 +43,30 @@
grid-area: editor; grid-area: editor;
} }
} }
.error-terminal-display {
background-color: black;
padding: 15px;
border-radius: 15px;
font-size: 1.2em;
line-height: 0.8em;
--red: #ff0000;
--cyan: #00d6d6;
code {
white-space: break-spaces;
font-family: monospace;
}
}
:root[data-theme="light"] {
.error-terminal-display {
background-color: lightgray;
--red: #ff3f3f;
--cyan: #00a6a6;
--black: lightgray;
--white: #4f4f4f;
}
}