-
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
Showing
14 changed files
with
259 additions
and
103 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Prism from "prismjs"; | ||
import { useEffect } from "react"; | ||
|
||
export default function CodeBlock(props: { code: string; language: string }) { | ||
useEffect(() => { | ||
Prism.highlightAll(); | ||
}, []); | ||
|
||
return ( | ||
<div className="overflow-x-scroll md:overflow-x-auto rounded-md"> | ||
<div className="text-md whitespace-pre-wrap font-cascadia"> | ||
<pre className={props.language ?? "language-javascript"}> | ||
<code>{props.code}</code> | ||
</pre> | ||
</div> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import CodeBlock from "./CodeBlock"; | ||
import RegularBlock from "./RegularBlock"; | ||
import XMailTable from "./Tables/XMailTable"; | ||
import Statistic from "./Statistic"; | ||
|
||
const MDXComponents = { | ||
h1: (props: { children: React.ReactNode }) => ( | ||
<h1 className="text-4xl font-bold font-rubik py-4 text-center md:text-left" {...props}> | ||
{props.children} | ||
</h1> | ||
), | ||
h2: (props: { children: React.ReactNode }) => ( | ||
<h1 className="text-2xl md:text-3xl font-bold font-rubik py-4 text-center md:text-left" {...props}> | ||
{props.children} | ||
</h1> | ||
), | ||
h3: (props: { children: React.ReactNode }) => ( | ||
<h1 className="text-xl md:text-2xl font-bold font-rubik py-4 text-center md:text-left" {...props}> | ||
{props.children} | ||
</h1> | ||
), | ||
a: (props: { children: React.ReactNode; href: string }) => { | ||
return ( | ||
<a href={props.href}> | ||
<Statistic hover={true}>{props.children}</Statistic> | ||
</a> | ||
); | ||
}, | ||
p: (props: { children: React.ReactNode }) => { | ||
return <p className="pb-4 font-normal leading-snug indent-4 text-left w-full">{props.children}</p>; | ||
}, | ||
code: (props: { children: React.ReactNode }) => { | ||
return <code className="px-2 text-red-600">{props.children}</code>; | ||
}, | ||
pre: (props: { children: React.ReactNode }) => { | ||
return ( | ||
<div className="overflow-x-scroll md:overflow-x-auto bg-slate-800 rounded-lg mt-4 mb-8"> | ||
<pre className="text-md p-4 mb-4 whitespace-pre-wrap">{props.children}</pre> | ||
</div> | ||
); | ||
}, | ||
blockquote: (props: { children: React.ReactNode }) => { | ||
return <blockquote className="indent-0 rounded-lg bg-slate-800 px-4 pt-4 mb-4">{props.children}</blockquote>; | ||
}, | ||
li: (props: { children: React.ReactNode }) => { | ||
return <li className="list-desc py-2">{props.children}</li>; | ||
}, | ||
ol: (props: { children: React.ReactNode }) => { | ||
return <ol className="md:indent-8 ml-4 px-2 md:px-4 list-decimal">{props.children}</ol>; | ||
}, | ||
ul: (props: { children: React.ReactNode }) => { | ||
return <ul className="list-desc">{props.children}</ul>; | ||
}, | ||
// biome-ignore lint/a11y/useAltText: <explanation> | ||
img: (props: { src: string }) => <img {...props} className="pt-8" />, | ||
XMailTable, | ||
CodeBlock, | ||
RegularBlock, | ||
}; | ||
|
||
export default MDXComponents; |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default function RegularBlock(props: { text: string }) { | ||
return ( | ||
<div className="overflow-x-scroll md:overflow-x-auto rounded-md"> | ||
<div className="text-md whitespace-pre-wrap font-cascadia"> | ||
<pre className="language-markdown"> | ||
<code>{props.text}</code> | ||
</pre> | ||
</div> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Statistic(props: { children: React.ReactNode; hover?: boolean }) { | ||
return <code className={`text-pink-600 font-bold ${props.hover && "hover:underline"}`}>{props.children}</code>; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export default function XMailTable() { | ||
return ( | ||
<div className="pb-6 flex flex-col"> | ||
<table className="table-auto border-2 border-spacing-2"> | ||
<thead> | ||
<tr> | ||
<th className="border border-slate-600 md:px-20">Subject</th> | ||
<th className="border border-slate-600 md:px-24">Sender</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td className="border border-slate-700 md:px-20">AP Computer Science Homework</td> | ||
<td className="border border-slate-700 md:px-24">Mr. Guy</td> | ||
</tr> | ||
<tr> | ||
<td className="border border-slate-700 md:px-20">Materials needed</td> | ||
<td className="border border-slate-700 md:px-24">Ms. Teacher</td> | ||
</tr> | ||
<tr> | ||
<td className="border border-slate-700 md:px-20">Welcome back to school</td> | ||
<td className="border border-slate-700 md:px-24">Mr. Principal</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
); | ||
} |
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
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
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
Oops, something went wrong.