1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00
Files
checktheroads-hyperglass/hyperglass/ui/components/markdown/table.tsx

28 lines
726 B
TypeScript
Raw Normal View History

2021-01-01 11:32:35 -07:00
import { Box } from '@chakra-ui/react';
import { useColorValue } from '~/context';
import type { BoxProps } from '@chakra-ui/react';
2021-01-03 23:51:09 -07:00
export const Table: React.FC<BoxProps> = (props: BoxProps) => (
2021-01-01 11:32:35 -07:00
<Box as="table" textAlign="left" mt={4} width="full" {...props} />
);
2021-01-03 23:51:09 -07:00
export const TH: React.FC<BoxProps> = (props: BoxProps) => {
2021-01-01 11:32:35 -07:00
const bg = useColorValue('blackAlpha.50', 'whiteAlpha.50');
return <Box as="th" bg={bg} fontWeight="semibold" p={2} fontSize="sm" {...props} />;
};
2021-01-03 23:51:09 -07:00
export const TD: React.FC<BoxProps> = (props: BoxProps) => {
2021-01-01 11:32:35 -07:00
return (
<Box
p={2}
as="td"
fontSize="sm"
whiteSpace="normal"
borderTopWidth="1px"
borderColor="inherit"
{...props}
/>
);
};