Skip to content

Commit f10ecac

Browse files
claudebrenelz
andcommitted
tutorial: give the REPL its dark theme and inset it
SolidBase marks dark mode with data-theme, but the REPL's dark styles need a .dark class on an ancestor, so its panels stayed light. From #1671. Co-authored-by: Brenley Dueck <brenleydueck@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWPLXmEUSKddsQSHkzN
1 parent b464a90 commit f10ecac

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎src/routes/(_)tutorial/[[id]].tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export default function Tutorial() {
214214
</div>
215215
</nav>
216216
</section>
217-
<section class="min-h-0 min-w-0" aria-label="Editor and preview">
217+
<section class="min-h-0 min-w-0 p-2" aria-label="Editor and preview">
218218
<Errored
219219
fallback={
220220
<p class="p-6 text-slate-700 dark:text-slate-300">

‎src/tutorials/repl.tsx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { createEffect } from "solid-js";
12
import UpstreamRepl, { type ReplProps } from "solid-repl";
23
import CompilerWorker from "solid-repl/dist/compiler.js?worker";
34
import FormatterWorker from "solid-repl/dist/formatter.js?worker";
@@ -15,5 +16,14 @@ if (import.meta.hot) {
1516
}
1617

1718
export default function Repl(props: Omit<ReplProps, "compiler" | "formatter">) {
19+
// The REPL's dark styles key off a `.dark` ancestor; SolidBase only sets data-theme.
20+
createEffect(
21+
() => props.dark,
22+
(dark) => {
23+
document.documentElement.classList.toggle("dark", !!dark);
24+
return () => document.documentElement.classList.remove("dark");
25+
}
26+
);
27+
1828
return <UpstreamRepl {...props} compiler={compiler} formatter={formatter} />;
1929
}

0 commit comments

Comments
 (0)