diff --git a/apps/temp-docs/components/CodeBlock/CodeBlock.tsx b/apps/temp-docs/components/CodeBlock/CodeBlock.tsx index 597b06a7389..103a242a107 100644 --- a/apps/temp-docs/components/CodeBlock/CodeBlock.tsx +++ b/apps/temp-docs/components/CodeBlock/CodeBlock.tsx @@ -7,6 +7,7 @@ import js from 'react-syntax-highlighter/dist/cjs/languages/hljs/javascript' import py from 'react-syntax-highlighter/dist/cjs/languages/hljs/python' import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql' import { useState } from 'react' +import { useTheme } from '../Providers' interface Props { lang: 'js' | 'sql' | 'py' @@ -16,8 +17,10 @@ interface Props { children?: string size?: 'small' | 'medium' | 'large' } - function CodeBlock(props: Props) { + const { isDarkMode } = useTheme() + const monokaiTheme = monokaiCustomTheme(isDarkMode) + const [copied, setCopied] = useState(false) const handleCopy = () => { @@ -42,26 +45,31 @@ function CodeBlock(props: Props) { // const large = props.size === 'large' ? true : false const large = false + // don't show line numbers if bash == lang + const showLineNumbers = lang !== 'bash' + return (
{!props.hideCopy && props.children ? ( -
+