import * as RadixTabs from "@radix-ui/react-tabs" import FormattingIcons from "app/(posts)/new/components/edit-document-list/edit-document/formatting-icons" import { ChangeEvent, useRef } from "react" import TextareaMarkdown, { TextareaMarkdownRef } from "textarea-markdown-editor" import Preview, { StaticPreview } from "../preview" import styles from "./tabs.module.css" type Props = RadixTabs.TabsProps & { isEditing: boolean defaultTab: "preview" | "edit" handleOnContentChange?: (e: ChangeEvent) => void onPaste?: (e: any) => void title?: string content?: string preview?: string } export default function DocumentTabs({ isEditing, defaultTab, handleOnContentChange, onPaste, title, content, preview, ...props }: Props) { const codeEditorRef = useRef(null) const handleTabChange = (newTab: string) => { if (newTab === "preview") { codeEditorRef.current?.focus() } } return ( {isEditing ? "Edit" : "Raw"} {isEditing ? "Preview" : "Rendered"}