2022-11-10 02:11:36 -05:00
|
|
|
"use client"
|
2022-11-12 04:28:06 -05:00
|
|
|
import ShiftBy from "@components/shift-by"
|
2022-11-15 22:07:07 -05:00
|
|
|
import { Spacer, Tabs, Textarea, Text } from "@geist-ui/core/dist"
|
2022-04-09 20:48:19 -04:00
|
|
|
import Image from "next/image"
|
|
|
|
import styles from "./home.module.css"
|
2022-11-12 04:28:06 -05:00
|
|
|
// TODO:components/new-post/ move these styles
|
2022-11-12 04:57:30 -05:00
|
|
|
import markdownStyles from "app/(posts)/components/preview/preview.module.css";
|
2022-11-15 22:07:07 -05:00
|
|
|
import Card from "./card"
|
2022-04-09 20:48:19 -04:00
|
|
|
const Home = ({
|
|
|
|
introTitle,
|
|
|
|
introContent,
|
|
|
|
rendered
|
|
|
|
}: {
|
|
|
|
introTitle: string
|
|
|
|
introContent: string
|
|
|
|
rendered: string
|
2022-03-24 21:03:57 -04:00
|
|
|
}) => {
|
2022-04-09 20:48:19 -04:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div
|
|
|
|
style={{ display: "flex", flexDirection: "row", alignItems: "center" }}
|
|
|
|
>
|
|
|
|
<ShiftBy y={-2}>
|
|
|
|
<Image
|
|
|
|
src={"/assets/logo-optimized.svg"}
|
2022-11-08 03:23:28 -05:00
|
|
|
width={48}
|
|
|
|
height={48}
|
2022-04-09 20:48:19 -04:00
|
|
|
alt=""
|
2022-11-11 22:17:44 -05:00
|
|
|
priority
|
2022-04-09 20:48:19 -04:00
|
|
|
/>
|
|
|
|
</ShiftBy>
|
|
|
|
<Spacer />
|
|
|
|
<Text style={{ display: "inline" }} h1>
|
|
|
|
{introTitle}
|
|
|
|
</Text>
|
|
|
|
</div>
|
|
|
|
<Card>
|
|
|
|
<Tabs initialValue={"preview"} hideDivider leftSpace={0}>
|
|
|
|
<Tabs.Item label={"Raw"} value="edit">
|
|
|
|
{/* <textarea className={styles.lineCounter} wrap='off' readOnly ref={lineNumberRef}>1.</textarea> */}
|
|
|
|
<div
|
|
|
|
style={{
|
2022-11-15 22:07:07 -05:00
|
|
|
marginTop: "var(--gap)",
|
2022-04-09 20:48:19 -04:00
|
|
|
display: "flex",
|
|
|
|
flexDirection: "column"
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Textarea
|
|
|
|
readOnly
|
|
|
|
value={introContent}
|
|
|
|
width="100%"
|
|
|
|
// TODO: Textarea should grow to fill parent if height == 100%
|
|
|
|
style={{ flex: 1, minHeight: 350 }}
|
|
|
|
resize="vertical"
|
|
|
|
className={styles.textarea}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</Tabs.Item>
|
|
|
|
<Tabs.Item label="Preview" value="preview">
|
2022-11-15 22:07:07 -05:00
|
|
|
<div>
|
2022-04-09 20:48:19 -04:00
|
|
|
<article
|
|
|
|
className={markdownStyles.markdownPreview}
|
|
|
|
dangerouslySetInnerHTML={{ __html: rendered }}
|
|
|
|
style={{
|
|
|
|
height: "100%"
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</Tabs.Item>
|
|
|
|
</Tabs>
|
|
|
|
</Card>
|
|
|
|
</>
|
|
|
|
)
|
2022-03-24 21:03:57 -04:00
|
|
|
}
|
|
|
|
|
2022-04-09 20:48:19 -04:00
|
|
|
export default Home
|