1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-06-17 10:03:15 +02:00
docs/src/components/DocContent.jsx

27 lines
648 B
React
Raw Normal View History

import React from 'react'
import PropTypes from 'prop-types'
2018-11-11 01:32:05 +01:00
import RehypeReact from 'rehype-react'
2019-09-18 11:21:18 +02:00
import Repository from './Repository'
import styles from './DocContent.module.scss'
2018-11-11 01:32:05 +01:00
const renderAst = new RehypeReact({
createElement: React.createElement,
components: { repo: Repository }
2018-11-11 01:32:05 +01:00
}).Compiler
const DocContent = ({ html, htmlAst }) =>
html ? (
<div className={styles.docContent}>{renderAst(htmlAst)}</div>
) : (
<div className={styles.empty}>
This is a placeholder for now. Help creating it.
</div>
)
DocContent.propTypes = {
html: PropTypes.string,
htmlAst: PropTypes.object
}
export default DocContent