-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f014de6
commit b821f7c
Showing
2 changed files
with
19 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
import DataTable from "react-data-table-component"; | ||
import ReactMarkdown from "react-markdown"; | ||
import ReactMarkdown, { Components } from "react-markdown"; | ||
import fs from "fs"; | ||
import Link from "next/link"; | ||
|
||
export function getStaticProps() { | ||
return { props: { readme: fs.readFileSync("README.md").toString() } } | ||
} | ||
|
||
const components: Components = { | ||
a: ({ href, children }) => | ||
<Link href={href || "#"} target={href?.startsWith("http") ? "_blank" : "_self"}> | ||
{children} | ||
</Link> | ||
} | ||
|
||
const Index = ({ readme }: { readme: string }) => | ||
<div className={"markdown-body"}> | ||
<ReactMarkdown>{readme}</ReactMarkdown> | ||
<DataTable | ||
columns={[ { name: "Str" }, { name: "Num" } ]} | ||
data={[ { Str: "A", Num: 1 } ]} | ||
// This line causes a hydration error in the pagination footer "nav" element (iff the | ||
// browser window is ≥599px wide); commenting this line fixes it. | ||
pagination | ||
/> | ||
</div> | ||
<ReactMarkdown components={components}>{readme}</ReactMarkdown> | ||
<DataTable | ||
columns={[ { name: "Str" }, { name: "Num" } ]} | ||
data={[ { Str: "A", Num: 1 } ]} | ||
// This line causes a hydration error in the pagination footer "nav" element (iff the | ||
// browser window is ≥599px wide); commenting this line fixes it. | ||
pagination | ||
/> | ||
</div> | ||
|
||
export default Index |