Skip to content

Commit

Permalink
array.prototype.map() => React.Children.Map()
Browse files Browse the repository at this point in the history
  • Loading branch information
thedannywahl committed Feb 16, 2024
1 parent f38271f commit 9e6e243
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions isp-site/src/components/mdtoui.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Children } from "react";

// Modules
import {
View,
Expand Down Expand Up @@ -143,34 +145,38 @@ const mdtoui = {
const { children, ...tableProps } = props;
return (
<Table margin="medium none" hover={true} caption="" {...tableProps}>
{children.map((node, i) => {
if (node.type === "thead") {
const { children, ...theadProps } = node.props;
{Children.map(children, (child) => {
const { children, ...tProps } = child.props;
if (child.type === "thead") {
return (
<Table.Head key={i.toString()} {...theadProps}>
<Table.Row key={children.key}>
{children.props.children.map((node, i) => {
return (
<Table.ColHeader
key={i.toString()}
id={i.toString()}
{...node.props}
/>
);
})}
</Table.Row>
<Table.Head {...tProps}>
{Children.map(children, (child) => {
const { children, ...thrProps } = child.props;
return (
<Table.Row {...thrProps}>
{Children.map(children, (child) => {
return (
<Table.ColHeader
key={child.toString()}
id={child.toString()}
{...child.props}
/>
);
})}
</Table.Row>
);
})}
</Table.Head>
);
}
const { children, ...tbodyProps } = node.props;
return (
<Table.Body key={i.toString()} {...tbodyProps}>
{children.map((node, i) => {
const { children, ...trProps } = node.props;
<Table.Body {...tProps}>
{Children.map(children, (child) => {
const { children, ...tbrProps } = child.props;
return (
<Table.Row key={i.toString()} {...trProps}>
{children.map((node, i) => {
return <Table.Cell key={i.toString()} {...node.props} />;
<Table.Row {...tbrProps}>
{Children.map(children, (child) => {
return <Table.Cell {...child.props} />;
})}
</Table.Row>
);
Expand Down

0 comments on commit 9e6e243

Please sign in to comment.