import { memo, useRef, useState } from "react" import styles from "./document.module.css" import Download from "@geist-ui/icons/download" import ExternalLink from "@geist-ui/icons/externalLink" import Skeleton from "react-loading-skeleton" import Link from "next/link" import { Button, ButtonGroup, Spacer, Tabs, Textarea, Tooltip, Tag } from "@geist-ui/core/dist" import HtmlPreview from "@components/preview" import FadeIn from "@components/fade-in" // import Link from "next/link" type Props = { title: string initialTab?: "edit" | "preview" skeleton?: boolean id: string content: string } const DownloadButton = ({ rawLink }: { rawLink?: string }) => { return (
) } const Document = ({ content, title, initialTab = "edit", skeleton, id }: Props) => { const codeEditorRef = useRef(null) const [tab, setTab] = useState(initialTab) // const height = editable ? "500px" : '100%' const height = "100%" const handleTabChange = (newTab: string) => { if (newTab === "edit") { codeEditorRef.current?.focus() } setTab(newTab as "edit" | "preview") } const rawLink = () => { if (id) { return `/file/raw/${id}` } } if (skeleton) { return ( <>
) } return (
{title || "Untitled"}
{/* */}