Skip to content

Commit

Permalink
tshit
Browse files Browse the repository at this point in the history
  • Loading branch information
kellyjosephprice committed May 7, 2024
1 parent 82897d8 commit c13d997
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions components/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ import React from 'react';
interface Props extends JSX.IntrinsicAttributes {
align?: ('left' | 'center' | 'right')[];
children: [React.ReactElement<HTMLTableCaptionElement | HTMLTableSectionElement | HTMLTableRowElement>];
rows?: [[any]];
rows?: any[][];
}

const TableContent = ({ rows, align = [] }: Omit<Props, 'children'>) => {
interface TableContentProps {
align?: Props['align'];
rows: Props['rows'];
}

const TableContent = ({ rows, align = [] }: TableContentProps) => {
const [head, ...body] = rows;

return (
Expand All @@ -32,12 +37,12 @@ const TableContent = ({ rows, align = [] }: Omit<Props, 'children'>) => {
};

const Table = (props: Props) => {
const { children, ...rest } = props;
const { children, rows, align } = props;

return (
<div className="rdmd-table">
<div className="rdmd-table-inner">
<table>{rest.rows ? <TableContent {...rest} /> : children}</table>
<table>{rows ? <TableContent align={align} rows={rows} /> : children}</table>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion errors/mdx-syntax-error.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { VFileMessage } from 'vfile-message';

export default class MdxSyntaxError extends SyntaxError {
original = '';
original: VFileMessage = null;

constructor(error: VFileMessage, doc: string) {
const { message, line, column, url } = error;
Expand Down

0 comments on commit c13d997

Please sign in to comment.