mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-14 00:32:47 +02:00
refactor(v2): avoid to use raw theme values (#2254)
This commit is contained in:
parent
d1219b1233
commit
ab25ee3e0f
6 changed files with 47 additions and 34 deletions
|
@ -42,10 +42,10 @@ export default ({children, className: languageClassName, metastring}) => {
|
|||
const button = useRef(null);
|
||||
let highlightLines = [];
|
||||
|
||||
const {theme} = useThemeContext();
|
||||
const {isDarkTheme} = useThemeContext();
|
||||
const lightModeTheme = prism.theme || defaultTheme;
|
||||
const darkModeTheme = prism.darkTheme || lightModeTheme;
|
||||
const prismTheme = theme === 'dark' ? darkModeTheme : lightModeTheme;
|
||||
const prismTheme = isDarkTheme ? darkModeTheme : lightModeTheme;
|
||||
|
||||
if (metastring && highlightLinesRangeRegex.test(metastring)) {
|
||||
const highlightLinesRange = metastring.match(highlightLinesRangeRegex)[1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue