Skip to content

Commit

Permalink
Docusaurus: make parallel blocks functional (#5663)
Browse files Browse the repository at this point in the history
* make parallel blocks functional
  • Loading branch information
jharrell committed Apr 10, 2024
1 parent 644ae82 commit 96a0396
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/theme/MDXComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,25 @@ const SwitchTech: React.FC<React.PropsWithChildren> = ({ children }) => {
return <p>{children}</p>
}

// TODO: we should fix this
const ParallelBlocks: React.FC<React.PropsWithChildren> = ({ children }) => {
return <>{children}</>
const childArray = React.Children.toArray(children).map(child => {
if (React.isValidElement(child)) {
return <div className='col col--6'>
<b>{child.props.content}</b>
<div>{child}</div>
</div>
} else {
return <div className='col col--6'>
<div>{child}</div>
</div>
}
});

return <div className='container'>
<div className='row'>
{childArray}
</div>
</div>
}

type ButtonColor = 'red' | 'green' | 'grey' | 'grey-bg' | 'dark'
Expand Down

0 comments on commit 96a0396

Please sign in to comment.