mirror of https://github.com/ethereum/go-ethereum
parent
71ce846b9e
commit
649918abe5
@ -0,0 +1,37 @@ |
||||
// Libraries
|
||||
import { Code as ChakraCode } from '@chakra-ui/react'; |
||||
import { FC } from 'react'; |
||||
|
||||
// Utils
|
||||
import { getProgrammingLanguageName } from '../../../utils'; |
||||
|
||||
|
||||
interface Props { |
||||
code: any; |
||||
} |
||||
|
||||
export const Code: FC<Props> = ({ code }) => { |
||||
const language = getProgrammingLanguageName(code); |
||||
|
||||
return ( |
||||
!!code.inline ? |
||||
( |
||||
<ChakraCode |
||||
background='gray.200' |
||||
fontFamily='"JetBrains Mono", monospace' |
||||
fontWeight={400} |
||||
fontSize='md' |
||||
lineHeight={4} |
||||
letterSpacing='1%' |
||||
pb={2} |
||||
mb={-2} |
||||
> |
||||
{code.children[0]} |
||||
</ChakraCode> |
||||
) |
||||
:
|
||||
( |
||||
<p>test</p> |
||||
) |
||||
); |
||||
}; |
@ -0,0 +1 @@ |
||||
export * from './Code'; |
@ -1,7 +1,7 @@ |
||||
// WIP
|
||||
export const getProgrammingLanguageName = (code: any) => { |
||||
// const hasLanguageNameProperty = Object.keys(code.node.properties).length > 0;
|
||||
console.log({ code }); |
||||
// console.log({ code });
|
||||
|
||||
// return hasLanguageNameProperty ? code.node.properties.className[0].split('-')[1] : 'bash';
|
||||
}; |
||||
|
Loading…
Reference in new issue