From 019baf06dd2e7feec4f6da1e2639dc45de12b6d1 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 14 Oct 2020 02:39:06 +0200 Subject: [PATCH] Add a default style context --- src/components/Rendering/Code.js | 6 ++++-- src/contexts/CodeDefaultStyle.js | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/contexts/CodeDefaultStyle.js diff --git a/src/components/Rendering/Code.js b/src/components/Rendering/Code.js index 759a9e4..60d323d 100644 --- a/src/components/Rendering/Code.js +++ b/src/components/Rendering/Code.js @@ -1,14 +1,16 @@ import SyntaxHighlighter from 'react-syntax-highlighter' -import {monokai} from "react-syntax-highlighter/dist/cjs/styles/hljs"; import stripTabs from "../../utils/stripTabs"; import {useContext} from "preact/hooks"; import CodeDefaultLanguage from "../../contexts/CodeDefaultLanguage"; +import CodeDefaultStyle from "../../contexts/CodeDefaultStyle"; export default function(props) { const language = useContext(CodeDefaultLanguage) + const style = useContext(CodeDefaultStyle) return ( - + {stripTabs(String(props.children))} ) diff --git a/src/contexts/CodeDefaultStyle.js b/src/contexts/CodeDefaultStyle.js new file mode 100644 index 0000000..210db47 --- /dev/null +++ b/src/contexts/CodeDefaultStyle.js @@ -0,0 +1,4 @@ +import {createContext} from "preact"; +import {tomorrowNightBlue} from "react-syntax-highlighter/dist/cjs/styles/hljs"; + +export default createContext(tomorrowNightBlue);