mirror of https://github.com/ethereum/go-ethereum
commit
5364cb731e
@ -0,0 +1,38 @@ |
||||
// Libraries
|
||||
import { Code as ChakraCode, Stack, Text } from '@chakra-ui/react'; |
||||
import { FC } from 'react'; |
||||
|
||||
interface Props { |
||||
code: any; |
||||
} |
||||
|
||||
export const Code: FC<Props> = ({ code }) => { |
||||
return ( |
||||
!!code.inline ? |
||||
( |
||||
<Text |
||||
as='span' |
||||
background='code-bg' |
||||
textStyle='inline-code-snippet' |
||||
pb={2} |
||||
mb={-2} |
||||
> |
||||
{code.children[0]} |
||||
</Text> |
||||
) |
||||
:
|
||||
( |
||||
<Stack> |
||||
<ChakraCode |
||||
overflow='auto' |
||||
p={6} |
||||
background='code-bg-contrast' |
||||
textStyle='code-block' |
||||
color='code-text' |
||||
> |
||||
{code.children[0]} |
||||
</ChakraCode> |
||||
</Stack> |
||||
) |
||||
); |
||||
}; |
@ -0,0 +1 @@ |
||||
export * from './Code'; |
@ -1,7 +0,0 @@ |
||||
// WIP
|
||||
export const getProgrammingLanguageName = (code: any) => { |
||||
// const hasLanguageNameProperty = Object.keys(code.node.properties).length > 0;
|
||||
console.log({ code }); |
||||
|
||||
// return hasLanguageNameProperty ? code.node.properties.className[0].split('-')[1] : 'bash';
|
||||
}; |
@ -1 +0,0 @@ |
||||
export * from './getProgrammingLanguageName'; |
Loading…
Reference in new issue