2020-10-07 09:41:58 -07:00
|
|
|
import * as React from 'react';
|
|
|
|
import { Box, useColorMode } from '@chakra-ui/core';
|
2020-01-17 02:50:57 -07:00
|
|
|
|
2020-09-28 11:54:00 -07:00
|
|
|
export const CodeBlock = ({ children }) => {
|
2020-07-05 17:20:10 -07:00
|
|
|
const { colorMode } = useColorMode();
|
2020-10-07 09:41:58 -07:00
|
|
|
const bg = { dark: 'gray.800', light: 'blackAlpha.100' };
|
|
|
|
const color = { dark: 'white', light: 'black' };
|
2020-07-05 17:20:10 -07:00
|
|
|
return (
|
|
|
|
<Box
|
|
|
|
fontFamily="mono"
|
|
|
|
mt={5}
|
|
|
|
p={3}
|
|
|
|
border="1px"
|
|
|
|
borderColor="inherit"
|
|
|
|
rounded="md"
|
|
|
|
bg={bg[colorMode]}
|
|
|
|
color={color[colorMode]}
|
|
|
|
fontSize="sm"
|
|
|
|
whiteSpace="pre-wrap"
|
2020-10-07 09:41:58 -07:00
|
|
|
as="pre">
|
2020-07-05 17:20:10 -07:00
|
|
|
{children}
|
|
|
|
</Box>
|
|
|
|
);
|
2020-01-17 02:50:57 -07:00
|
|
|
};
|