Skip to content

Commit

Permalink
PR review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 authored and yangshun committed Dec 21, 2019
1 parent ed1704d commit 69cbf5c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Clipboard from 'clipboard';
import rangeParser from 'parse-numeric-range';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useTheme from '@theme/hooks/useTheme';
import useEventBus from '@docusaurus/useEventBus';
import useEventBus from '@theme/hooks/useEventBus';
import styles from './styles.module.css';

const highlightLinesRangeRegex = /{([\d,-]+)}/;
Expand All @@ -29,11 +29,12 @@ export default ({children, className: languageClassName, metastring}) => {
const button = useRef(null);
let highlightLines = [];
const [theme] = useTheme();
const [prismTheme, setPrismTheme] = useState(defaultTheme);
const lightThemePrism = prism.theme || defaultTheme;
const [prismTheme, setPrismTheme] = useState(lightThemePrism);
const changePrismTheme = newTheme =>
prism.darkTheme && newTheme === 'dark'
? setPrismTheme(prism.darkTheme)
: setPrismTheme(defaultTheme);
: setPrismTheme(lightThemePrism);

if (metastring && highlightLinesRangeRegex.test(metastring)) {
const highlightLinesRange = metastring.match(highlightLinesRangeRegex)[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import React, {useCallback, useState} from 'react';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import {dispatch} from '@docusaurus/useEventBus';

import SearchBar from '@theme/SearchBar';
import Toggle from '@theme/Toggle';
Expand All @@ -18,6 +17,7 @@ import classnames from 'classnames';

import useTheme from '@theme/hooks/useTheme';
import useHideableNavbar from '@theme/hooks/useHideableNavbar';
import {dispatch} from '@theme/hooks/useEventBus';

import styles from './styles.module.css';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Clipboard from 'clipboard';
import rangeParser from 'parse-numeric-range';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useTheme from '@theme/hooks/useTheme';
import useEventBus from '@docusaurus/useEventBus';
import useEventBus from '@theme/hooks/useEventBus';
import Playground from '@theme/Playground';
import styles from './styles.module.css';

Expand All @@ -36,11 +36,12 @@ export default ({
const button = useRef(null);
let highlightLines = [];
const [theme] = useTheme();
const [prismTheme, setPrismTheme] = useState(defaultTheme);
const lightThemePrism = prism.theme || defaultTheme;
const [prismTheme, setPrismTheme] = useState(lightThemePrism);
const changePrismTheme = newTheme =>
prism.darkTheme && newTheme === 'dark'
? setPrismTheme(prism.darkTheme)
: setPrismTheme(defaultTheme);
: setPrismTheme(lightThemePrism);

if (metastring && highlightLinesRangeRegex.test(metastring)) {
const highlightLinesRange = metastring.match(highlightLinesRangeRegex)[1];
Expand Down
1 change: 1 addition & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ module.exports = {
],
themeConfig: {
prism: {
theme: require('prism-react-renderer/themes/github'),
darkTheme: require('prism-react-renderer/themes/dracula'),
},
image: 'img/docusaurus.png',
Expand Down

0 comments on commit 69cbf5c

Please sign in to comment.