Ola Rubaj c706575ae4
Replace @flowershow/* with @portaljs/* packages in /examples (#953)
* [examples/ckan][m]: rplc @flowershow with @portaljs packages

* [examples/fivethirtyeight][m]: rplc @flowershow with @portaljs packages

* [examples/turing][m]: rplc @flowershow with @portaljs packages

* [examples/openspending][m]: rplc @flowershow with @portaljs packages

* [examples/learn][m]: rplc @flowershow with @portaljs packages

* [examples/github-backed-catalog][m]: rplc @flowershow with @portaljs packages

* [examples/github-backed-catalog][xs] - fix build

* [examples][m] - fix builds

* [examples/openspending][xs] - fix build

---------

Co-authored-by: Luccas Mateus de Medeiros Gomes <luccasmmg@gmail.com>
2023-06-16 09:13:54 -03:00

22 lines
1012 B
TypeScript

import { MDXRemote } from 'next-mdx-remote';
import dynamic from 'next/dynamic';
import { Mermaid } from '@portaljs/core';
// Custom components/renderers to pass to MDX.
// Since the MDX files aren't loaded by webpack, they have no knowledge of how
// to handle import statements. Instead, you must include components in scope
// here.
const components = {
Table: dynamic(() => import('@portaljs/components').then(mod => mod.Table)),
Catalog: dynamic(() => import('@portaljs/components').then(mod => mod.Catalog)),
FlatUiTable: dynamic(() => import('@portaljs/components').then(mod => mod.FlatUiTable)),
mermaid: Mermaid,
Vega: dynamic(() => import('@portaljs/components').then(mod => mod.Vega)),
VegaLite: dynamic(() => import('@portaljs/components').then(mod => mod.VegaLite)),
LineChart: dynamic(() => import('@portaljs/components').then(mod => mod.LineChart)),
} as any;
export default function DRD({ source }: { source: any }) {
return <MDXRemote {...source} components={components} />;
}