Implement dark mode (#1455)

This commit is contained in:
Charlie Marsh 2022-12-29 19:33:46 -05:00 committed by GitHub
parent cd2099f772
commit 2c7464604a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 792 additions and 24 deletions

View file

@ -6,16 +6,19 @@ import Editor, { useMonaco } from "@monaco-editor/react";
import { MarkerSeverity, MarkerTag } from "monaco-editor";
import { useCallback, useEffect } from "react";
import { Check } from "../pkg";
import { Theme } from "./theme";
export default function SourceEditor({
visible,
source,
theme,
checks,
onChange,
}: {
visible: boolean;
source: string;
checks: Check[];
theme: Theme;
onChange: (pythonSource: string) => void;
}) {
const monaco = useMonaco();
@ -102,9 +105,9 @@ export default function SourceEditor({
roundedSelection: false,
scrollBeyondLastLine: false,
}}
wrapperProps={visible ? {} : { style: { display: "none" } }}
theme={"Ayu-Light"}
language={"python"}
wrapperProps={visible ? {} : { style: { display: "none" } }}
theme={theme === "light" ? "Ayu-Light" : "Ayu-Dark"}
value={source}
onChange={handleChange}
/>