XeNote/components/MDContent.js
Tuan Cao 36dcfbb2bc Wrapping MD Content inside MD Container
Boiler plate code for adding multiple MD Content
2022-03-31 16:59:10 +07:00

28 lines
993 B
JavaScript

import React from 'react';
import Alert from '@mui/material/Alert';
import AlertTitle from '@mui/material/AlertTitle';
import {useRouter} from 'next/router'
function MDContent({content, handleOpenNewContent}) {
function handleInternalLinkClick() {
//Processing fetching
//pass result up to parent container
//TODO: handle clicking on internal link, go fetching md content from file then passing it up to parent
handleOpenNewContent(content)
}
const router = useRouter();
return (
<div className="markdown-rendered">
<Alert severity="info">
<AlertTitle>Want to know more?</AlertTitle>
🌱 <strong>Follow</strong> or <strong>DM</strong> me on Twitter at <span><a href="https://twitter.com/tuancm">@tuancm</a></span>
</Alert>
<div dangerouslySetInnerHTML={{__html: content}}/>
<button onClick={handleInternalLinkClick}>Click me </button>
</div>
);
}
export default MDContent;