Skip to content

Commit

Permalink
feat: support dark mode better in Casbin editor (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
HashCookie authored Jul 22, 2024
1 parent fa2535d commit 95aa2fe
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/pages/editor.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from "react";
import Layout from "@theme/Layout";
import Giscus from "@giscus/react";
import {useColorMode} from "@docusaurus/theme-common";

function Editor() {
function EditorContent() {
const {colorMode} = useColorMode();
return (
<Layout title="Editor" description="Casbin Online Editor">
<>
<div className="editor-container">
<iframe
src="https://editor.casbin.org/"
src={`https://editor.casbin.org/?theme=${colorMode}`}
className="editor-iframe"
title="Casbin-editor"
/>
Expand All @@ -24,11 +26,22 @@ function Editor() {
reactionsEnabled="1"
emitMetadata="0"
inputPosition="top"
theme="light"
theme={colorMode}
lang="en"
loading="lazy"
/>
</div>
</>
);
}

function Editor() {
return (
<Layout
title="Editor"
description="Casbin Online Editor"
>
<EditorContent />
</Layout>
);
}
Expand Down

0 comments on commit 95aa2fe

Please sign in to comment.