Skip to content

Commit

Permalink
Merge pull request #84 from ethereum/md-table
Browse files Browse the repository at this point in the history
feat: add markdown table component [Fixes #35]
  • Loading branch information
wackerow authored Jun 20, 2024
2 parents 36554cc + 1304630 commit c571df0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/components/Table.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {
Table as ChakraTable,
TableContainer,
type ThemingProps,
} from '@chakra-ui/react'

export const Table = ({ variant, ...props }: ThemingProps<'Table'>) => (
<TableContainer whiteSpace="normal" mb="4">
<ChakraTable variant={variant} {...props} />
</TableContainer>
)
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export * from './Section'
export * from './ShowcaseSection'
export * from './SocialLinks'
export * from './SolidityLogo'
export * from './Table'
export * from './Triangle'
export * from './Triangles'
export * from './YouTube'
18 changes: 14 additions & 4 deletions src/styles/MDStyles.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import {
Box,
Divider,
Flex,
Heading,
Image,
Stack,
Table,
Tbody,
Td,
Text,
Th,
Thead,
type ThemingProps,
Tr,
} from '@chakra-ui/react'
import { Code, Link } from '@/components'
import { Code, Link, Table } from '@/components'

// TODO: Debug tables

export const MDStyles = {
Expand Down Expand Up @@ -87,4 +91,10 @@ export const MDStyles = {
hr: ({ children }: any) => {
return <Divider my={6}>{children}</Divider>
},
table: (props: ThemingProps<'Table'>) => <Table {...props} />,
thead: Thead,
th: Th,
tbody: Tbody,
tr: Tr,
td: Td,
}

0 comments on commit c571df0

Please sign in to comment.