From 86c21ed9ff77390f21698e8d5d8089db7a442b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20H=C3=B6lting?= <87192362+moritz-hoelting@users.noreply.github.com> Date: Thu, 15 Aug 2024 21:41:29 +0200 Subject: [PATCH] playground: make file view scrollable --- astro.config.mjs | 1 + src/components/override/Pagination.astro | 10 ++++++++++ src/styles/playground.scss | 17 +++++++++++++---- src/wasm/webcompiler/Cargo.toml | 3 +++ 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 src/components/override/Pagination.astro diff --git a/astro.config.mjs b/astro.config.mjs index 199c75c..26613ff 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -68,6 +68,7 @@ export default defineConfig({ components: { PageTitle: "./src/components/override/PageTitle.astro", ContentPanel: "./src/components/override/ContentPanel.astro", + Pagination: "./src/components/override/Pagination.astro", }, sidebar: [ { diff --git a/src/components/override/Pagination.astro b/src/components/override/Pagination.astro new file mode 100644 index 0000000..2526c5d --- /dev/null +++ b/src/components/override/Pagination.astro @@ -0,0 +1,10 @@ +--- +import type { Props } from "@astrojs/starlight/props"; +import Default from "@astrojs/starlight/components/Pagination.astro"; +import { isPlaygroundPage } from '@utils/playground'; + +const isPlayground = isPlaygroundPage(Astro.props.slug, Astro.currentLocale); +--- + + +{isPlayground ? <> : } diff --git a/src/styles/playground.scss b/src/styles/playground.scss index cb593b4..2ecb2cb 100644 --- a/src/styles/playground.scss +++ b/src/styles/playground.scss @@ -1,6 +1,6 @@ .playground { display: grid; - grid-template-columns: clamp(100px, 15%, 400px) auto; + grid-template-columns: clamp(200px, 15%, 500px) auto; grid-template-areas: "header header" "files editor"; @@ -14,13 +14,18 @@ flex-direction: column; margin-right: 0.5cm; overflow-x: hidden; - overflow-y: auto; + overflow-y: hidden; + max-height: 70vh; > h3 { cursor: pointer; } .entries { + overflow-y: auto; + overflow-x: hidden; + word-wrap: break-word; + button { border: none; width: 100%; @@ -41,6 +46,10 @@ } > .editor { grid-area: editor; + + .monaco-editor { + padding-block: 10px; + } } } @@ -53,7 +62,7 @@ --red: #ff0000; --cyan: #00d6d6; - + code { white-space: break-spaces; font-family: monospace; @@ -63,7 +72,7 @@ :root[data-theme="light"] { .error-terminal-display { background-color: lightgray; - + --red: #ff3f3f; --cyan: #00a6a6; --black: lightgray; diff --git a/src/wasm/webcompiler/Cargo.toml b/src/wasm/webcompiler/Cargo.toml index 5aaa798..428d9b6 100644 --- a/src/wasm/webcompiler/Cargo.toml +++ b/src/wasm/webcompiler/Cargo.toml @@ -6,6 +6,9 @@ edition = "2021" [lib] crate-type = ["cdylib"] +[profile.release] +opt-level = "s" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies]