Browse Source

[Beta] Fix code diagram layout

main
Dan Abramov 2 years ago
parent
commit
71eaccec3c
  1. 4
      beta/src/components/MDX/CodeDiagram.tsx

4
beta/src/components/MDX/CodeDiagram.tsx

@ -12,7 +12,7 @@ interface CodeDiagramProps {
export function CodeDiagram({children, flip = false}: CodeDiagramProps) { export function CodeDiagram({children, flip = false}: CodeDiagramProps) {
const illustration = React.Children.toArray(children).filter((child: any) => { const illustration = React.Children.toArray(children).filter((child: any) => {
return child.type?.mdxName === 'img'; return child.type === 'img';
}); });
const content = React.Children.toArray(children).map((child: any) => { const content = React.Children.toArray(children).map((child: any) => {
if (child.type?.mdxName === 'pre') { if (child.type?.mdxName === 'pre') {
@ -23,7 +23,7 @@ export function CodeDiagram({children, flip = false}: CodeDiagramProps) {
noMarkers={true} noMarkers={true}
/> />
); );
} else if (child.type?.mdxName === 'img') { } else if (child.type === 'img') {
return null; return null;
} else { } else {
return child; return child;

Loading…
Cancel
Save