More refactoring:
- Move markdown rendering to its own component.
This commit is contained in:
parent
08bf40fc35
commit
bc844bc0fa
17
components/MDContent.js
Normal file
17
components/MDContent.js
Normal file
@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import Alert from '@mui/material/Alert';
|
||||
import AlertTitle from '@mui/material/AlertTitle';
|
||||
|
||||
function MDContent({content}) {
|
||||
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}}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default MDContent;
|
@ -2,7 +2,7 @@ import Head from 'next/head'
|
||||
// import BasicTree from 'lib/MyFolderTree'
|
||||
export const siteTitle = 'Digital Backroom - An Internet Archive'
|
||||
import {Box} from '@mui/material'
|
||||
export default function Layout({children, home}) {
|
||||
export default function Layout({children}) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
@ -1,24 +1,17 @@
|
||||
import Layout from "../components/layout";
|
||||
import {getSinglePost, getDirectoryData, convertObject, getFlattenArray} from "../lib/utils";
|
||||
import FolderTree from "../components/FolderTree";
|
||||
import Alert from '@mui/material/Alert';
|
||||
import AlertTitle from '@mui/material/AlertTitle';
|
||||
import MDContent from "../components/MDContent";
|
||||
|
||||
export default function Home({content, tree, flattenNodes}) {
|
||||
|
||||
return (
|
||||
<Layout home>
|
||||
<Layout>
|
||||
<div className = 'container'>
|
||||
<nav className="nav-bar">
|
||||
<FolderTree tree={tree} flattenNodes={flattenNodes}/>
|
||||
</nav>
|
||||
<main 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.data}}/>
|
||||
</main>
|
||||
<MDContent content={note.data}/>
|
||||
</div>
|
||||
</Layout>
|
||||
);
|
||||
|
@ -3,12 +3,11 @@ import Layout from "../../components/layout";
|
||||
import {getPostListData, getSinglePost, getGraphData, convertObject, getDirectoryData} from "../../lib/utils";
|
||||
import FolderTree from "../../components/FolderTree";
|
||||
import {getFlattenArray} from "../../lib/utils";
|
||||
import Alert from '@mui/material/Alert';
|
||||
import AlertTitle from '@mui/material/AlertTitle';
|
||||
import MDContent from "../../components/MDContent";
|
||||
|
||||
export default function Home({ note, graphdata,tree, flattenNodes, ...props }) {
|
||||
export default function Home({ note, graphdata,tree, flattenNodes}) {
|
||||
return (
|
||||
<Layout home>
|
||||
<Layout>
|
||||
<Head>
|
||||
{note.title && <meta name="title" content={note.title} />}
|
||||
</Head>
|
||||
@ -16,13 +15,7 @@ export default function Home({ note, graphdata,tree, flattenNodes, ...props }) {
|
||||
<nav className="nav-bar">
|
||||
<FolderTree tree={tree} flattenNodes={flattenNodes}/>
|
||||
</nav>
|
||||
<main 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: note.data}}/>
|
||||
</main>
|
||||
<MDContent content={note.data}/>
|
||||
</div>
|
||||
</Layout>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user