25 lines
645 B
JavaScript
25 lines
645 B
JavaScript
import React from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import { usePluginData } from '@docusaurus/useGlobalData';
|
|
import { PropsTable } from '../react-docgen-props-table/PropsTable'
|
|
|
|
export function ComponentPropsTable({ componentName }) {
|
|
if (!componentName) {
|
|
return null;
|
|
}
|
|
|
|
const data = usePluginData('docusaurus-plugin-react-docgen')
|
|
const componentDocGenData = data[componentName.toLowerCase()]
|
|
if (!componentDocGenData) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<PropsTable className={'table-auto'} props={componentDocGenData.props}/>
|
|
)
|
|
}
|
|
|
|
ComponentPropsTable.PropTypes = {
|
|
componentName: PropTypes.string.required
|
|
}
|