11import React from 'react'
22import { Box , Text , Button , Octicon , themeGet } from '@primer/react'
3- import { Highlight , themes , Prism } from 'prism-react-renderer'
3+ import { Highlight , Prism } from 'prism-react-renderer'
44import styled from 'styled-components'
55import { CheckIcon , CopyIcon } from '@primer/octicons-react'
66import copyToClipboard from 'copy-to-clipboard'
77import { announce } from '../util/aria-live'
8+ import { usePrismTheme } from '../hooks/use-prism-theme'
89; ( typeof global !== 'undefined' ? global : window ) . Prism = Prism
910require ( 'prismjs/components/prism-bash' )
1011
@@ -98,9 +99,10 @@ const CodeBlock = ({children, code, className, style}) => (
9899)
99100
100101function Code ( { className = '' , prompt, children} ) {
102+ const { theme : codeTheme } = usePrismTheme ( )
101103 if ( prompt ) {
102104 return (
103- < CodeBlock style = { themes . github . plain } >
105+ < CodeBlock style = { codeTheme . plain } >
104106 < MonoText > { children } </ MonoText >
105107 </ CodeBlock >
106108 )
@@ -114,7 +116,7 @@ function Code({className = '', prompt, children}) {
114116 }
115117
116118 return (
117- < Highlight code = { code } language = { className . replace ( / l a n g u a g e - / , '' ) || 'bash' } theme = { themes . github } >
119+ < Highlight code = { code } language = { className . replace ( / l a n g u a g e - / , '' ) || 'bash' } theme = { codeTheme } >
118120 { ( { className : highlightClassName , style, tokens, getLineProps, getTokenProps} ) => (
119121 < CodeBlock className = { highlightClassName } style = { style } code = { code } >
120122 { tokens . map ( ( line , i ) => (
0 commit comments