Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support dark mode better in Casbin editor #247

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading