| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | import React from 'react' | |
| 2 | 2 | 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' | ||
| 4 | 4 | import Highlight, { defaultProps } from 'prism-react-renderer' | |
| 5 | 5 | import { | |
| 6 | 6 | LiveProvider, | |
@@ -183,7 +183,8 @@ function importToRequire(code) { | |||
| 183 | 183 | ||
| 184 | 184 | export function usePrismTheme() { | |
| 185 | 185 | const theme = useTheme() | |
| 186 | - return th('prism-theme')({ theme }) | ||
| 186 | + const [mode] = useColorMode() | ||
| 187 | + return th(`prism-theme-${mode === 'light' ? 'light' : 'dark'}`)({ theme }) | ||
| 187 | 188 | } | |
| 188 | 189 | ||
| 189 | 190 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,16 +1,13 @@ | |||
| 1 | 1 | import React from 'react' | |
| 2 | 2 | import { PageLayout } from './PageLayout' | |
| 3 | 3 | import { DocLayout } from './DocLayout' | |
| 4 | - import { withPrefix } from "gatsby" | ||
| 5 | - import Helmet from "react-helmet" | ||
| 6 | 4 | ||
| 7 | 5 | export function PageWrapper({ | |
| 8 | 6 | children, | |
| 9 | 7 | props: { | |
| 10 | 8 | data: { mdx }, | |
| 11 | 9 | }, | |
| 12 | 10 | }) { | |
| 13 | - const isBrowser = typeof window !== 'undefined' | ||
| 14 | 11 | if (!mdx?.fields?.pageType) return children | |
| 15 | 12 | switch (mdx.fields.pageType) { | |
| 16 | 13 | case 'doc': | |
@@ -21,9 +18,6 @@ export function PageWrapper({ | |||
| 21 | 18 | editLink={mdx.fields.editLink} | |
| 22 | 19 | > | |
| 23 | 20 | {children} | |
| 24 | - <Helmet> | ||
| 25 | - {isBrowser && <script defer="defer" src={withPrefix('Contributors.js')} />} | ||
| 26 | - </Helmet> | ||
| 27 | 21 | </DocLayout> | |
| 28 | 22 | ) | |
| 29 | 23 | case 'page': | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,5 @@ | |||
| 1 | 1 | import customThemeDark from 'prism-react-renderer/themes/nightOwl' | |
| 2 | + import customThemeLight from 'prism-react-renderer/themes/nightOwlLight' | ||
| 2 | 3 | ||
| 3 | 4 | import { transparentize } from 'polished' | |
| 4 | 5 | import { css, th, defaultTheme, aliasColor } from '@xstyled/styled-components' | |
@@ -27,7 +28,8 @@ export const theme = { | |||
| 27 | 28 | outline-color: primary-500; | |
| 28 | 29 | } | |
| 29 | 30 | `, | |
| 30 | - 'prism-theme': customThemeDark, | ||
| 31 | + 'prism-theme-dark': customThemeDark, | ||
| 32 | + 'prism-theme-light': customThemeLight, | ||
| 31 | 33 | fonts: { | |
| 32 | 34 | base: '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif', | |
| 33 | 35 | }, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments