Skip to content

Commit

Permalink
keeping dark theme code block in light theme
Browse files Browse the repository at this point in the history
Signed-off-by: Mannika <[email protected]>
  • Loading branch information
mannika763 authored Jul 19, 2024
1 parent ae97610 commit 612ca96
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { useState } from "react";
import Code from "../../../../../components/CodeBlock";
import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode";
export const CodeBlock = ({ name, code }) => {
const { isDark } = useStyledDarkMode();
const [showCode, setShowCode] = useState(false);
const onChange = () => {
setShowCode((prev) => !prev);
Expand All @@ -13,14 +11,9 @@ export const CodeBlock = ({ name, code }) => {
<label htmlFor={name} className="label">
Show Code
</label>
{showCode && isDark && (
{showCode && (
<Code codeString={code} language="javascript" />
)}
{showCode && !isDark && (
<pre className="code">
<code lang="javascript">{code}</code>
</pre>
)}
</div>
);
};

0 comments on commit 612ca96

Please sign in to comment.