CoastalCommitsPastes/client/app/components/home.tsx

69 lines
1.6 KiB
TypeScript
Raw Normal View History

2022-11-10 02:11:36 -05:00
"use client"
2022-11-18 01:36:53 -05:00
import { Tabs, Textarea } 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-16 03:49:12 -05:00
import markdownStyles from "app/(posts)/components/preview/preview.module.css"
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" }}
>
2022-11-16 03:49:12 -05:00
<Image
src={"/assets/logo-optimized.svg"}
width={48}
height={48}
alt=""
priority
/>
<h1 style={{ marginLeft: "var(--gap)" }}>{introTitle}</h1>
2022-04-09 20:48:19 -04:00
</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={{
marginTop: "var(--gap)",
2022-04-09 20:48:19 -04:00
display: "flex",
flexDirection: "column"
}}
>
2022-11-16 03:49:12 -05:00
<textarea
2022-04-09 20:48:19 -04:00
readOnly
value={introContent}
// TODO: Textarea should grow to fill parent if height == 100%
style={{ flex: 1, minHeight: 350 }}
className={styles.textarea}
/>
</div>
</Tabs.Item>
<Tabs.Item label="Preview" value="preview">
<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