FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove unused code and add prism to switcher · mcjava-wiki/mcjava-wiki@6f7efa5 · GitHub

Repository navigation

Commit 6f7efa5

Browse files
committed
Remove unused code and add prism to switcher
Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
1 parent 864d9a7 commit 6f7efa5

4 files changed

Lines changed: 6 additions & 72 deletions

File tree

‎src/components/Code.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import rangeParser from 'parse-numeric-range';
3-
import styled, { useTheme, th, up, css } from '@xstyled/styled-components'
3+
import styled, { useTheme, th, up, css, useColorMode } from '@xstyled/styled-components'
44
import Highlight, { defaultProps } from 'prism-react-renderer'
55
import {
66
LiveProvider,
@@ -183,7 +183,8 @@ function importToRequire(code) {
183183

184184
export function usePrismTheme() {
185185
const theme = useTheme()
186-
return th('prism-theme')({ theme })
186+
const [mode] = useColorMode()
187+
return th(`prism-theme-${mode === 'light' ? 'light' : 'dark'}`)({ theme })
187188
}
188189

189190

‎src/components/PageWrapper.js‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import React from 'react'
22
import { PageLayout } from './PageLayout'
33
import { DocLayout } from './DocLayout'
4-
import { withPrefix } from "gatsby"
5-
import Helmet from "react-helmet"
64

75
export function PageWrapper({
86
children,
97
props: {
108
data: { mdx },
119
},
1210
}) {
13-
const isBrowser = typeof window !== 'undefined'
1411
if (!mdx?.fields?.pageType) return children
1512
switch (mdx.fields.pageType) {
1613
case 'doc':
@@ -21,9 +18,6 @@ export function PageWrapper({
2118
editLink={mdx.fields.editLink}
2219
>
2320
{children}
24-
<Helmet>
25-
{isBrowser && <script defer="defer" src={withPrefix('Contributors.js')} />}
26-
</Helmet>
2721
</DocLayout>
2822
)
2923
case 'page':

‎src/theme.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import customThemeDark from 'prism-react-renderer/themes/nightOwl'
2+
import customThemeLight from 'prism-react-renderer/themes/nightOwlLight'
23

34
import { transparentize } from 'polished'
45
import { css, th, defaultTheme, aliasColor } from '@xstyled/styled-components'
@@ -27,7 +28,8 @@ export const theme = {
2728
outline-color: primary-500;
2829
}
2930
`,
30-
'prism-theme': customThemeDark,
31+
'prism-theme-dark': customThemeDark,
32+
'prism-theme-light': customThemeLight,
3133
fonts: {
3234
base: '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif',
3335
},

‎static/Contributors.js‎

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL