Update example to use new DataExplorer component
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
|
import React from 'react'
|
||||||
import {
|
import {
|
||||||
KeyInfo,
|
|
||||||
PlotlyChart,
|
PlotlyChart,
|
||||||
Table,
|
ReadMe,
|
||||||
ReadMe
|
DataExplorer,
|
||||||
} from 'portal'
|
} from 'portal/dist/index.cjs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import { getDataset } from '../lib/dataset'
|
import { getDataset } from '../lib/dataset'
|
||||||
@@ -34,15 +34,6 @@ export default function Home({ dataset, specs }) {
|
|||||||
const descriptor = dataset['descriptor']
|
const descriptor = dataset['descriptor']
|
||||||
const resources = dataset['resources']
|
const resources = dataset['resources']
|
||||||
|
|
||||||
const columns = resources[0].schema.fields.map((field) => {
|
|
||||||
return {
|
|
||||||
field: field.name,
|
|
||||||
headerName: field.name,
|
|
||||||
flex: 1
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const tableSample = resources[0].sample
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<Head>
|
<Head>
|
||||||
@@ -80,13 +71,7 @@ export default function Home({ dataset, specs }) {
|
|||||||
<h1 className="text-2xl font-bold mb-4">Data Preview</h1>
|
<h1 className="text-2xl font-bold mb-4">Data Preview</h1>
|
||||||
<div className='ml-3'>
|
<div className='ml-3'>
|
||||||
<h2 className="text-1xl">{descriptor.title}</h2>
|
<h2 className="text-1xl">{descriptor.title}</h2>
|
||||||
{resources[0].sample ? (
|
<DataExplorer resources={resources} />
|
||||||
<div >
|
|
||||||
<Table columns={columns} data={tableSample} />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
'No preview is available for this dataset'
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user