Add Wall of Text component to website
This commit is contained in:
15
astro/src/components/web/WallOfText.astro
Normal file
15
astro/src/components/web/WallOfText.astro
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
|
||||
interface Props {
|
||||
wallOfText: WallOfTextComponent;
|
||||
}
|
||||
|
||||
const wallOfText = Astro.props.wallOfText;
|
||||
console.log(markdownToHtml(wallOfText.text));
|
||||
---
|
||||
|
||||
<div id={`walloftext-${wallOfText.id}`} class="flex flex-col py-12 px-12 container mx-auto gap-4">
|
||||
<h2 class="text-5xl font-bold">{wallOfText.title}</h2>
|
||||
<div set:html={markdownToHtml(wallOfText.text)}></div>
|
||||
</div>
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
import Hero from '../web/Hero.astro';
|
||||
import TextWithImage from '../web/TextWithImage.astro';
|
||||
import WallOfText from '../web/WallOfText.astro';
|
||||
|
||||
interface Props {
|
||||
webpage: WebpageComponent[];
|
||||
@@ -16,6 +17,7 @@ console.log(Astro.props.webpage);
|
||||
<Fragment>
|
||||
{ component.component === "Hero" && <Hero hero={component} /> }
|
||||
{ component.component === "TextWithImage" && <TextWithImage textWithImage={component} /> }
|
||||
{ component.component === "WallOfText" && <WallOfText wallOfText={component} /> }
|
||||
</Fragment>
|
||||
)) }
|
||||
</div>
|
||||
|
||||
9
astro/src/lib/markdown.ts
Normal file
9
astro/src/lib/markdown.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import markdownit from "markdown-it";
|
||||
import markdownitHighlightjs from "markdown-it-highlightjs";
|
||||
|
||||
export function markdownToHtml(markdown: string) {
|
||||
const md = markdownit()
|
||||
.use(markdownitHighlightjs);
|
||||
|
||||
return md.render(markdown);
|
||||
}
|
||||
Reference in New Issue
Block a user