diff --git a/client/app/(posts)/new/components/edit-document-list/edit-document/index.tsx b/client/app/(posts)/new/components/edit-document-list/edit-document/index.tsx index 3c8225a3..e4f0c302 100644 --- a/client/app/(posts)/new/components/edit-document-list/edit-document/index.tsx +++ b/client/app/(posts)/new/components/edit-document-list/edit-document/index.tsx @@ -5,13 +5,12 @@ import Button from "@components/button" import Input from "@components/input" import DocumentTabs from "app/(posts)/components/tabs" -// import Link from "next/link" type Props = { title?: string content?: string setTitle?: (title: string) => void handleOnContentChange?: (e: ChangeEvent) => void - initialTab?: "edit" | "preview" + defaultTab?: "edit" | "preview" remove?: () => void onPaste?: (e: any) => void } @@ -22,7 +21,7 @@ const Document = ({ title, content, setTitle, - initialTab = "edit", + defaultTab = "edit", handleOnContentChange }: Props) => { // const height = editable ? "500px" : '100%' @@ -86,7 +85,7 @@ const Document = ({
diff --git a/client/app/components/input/index.tsx b/client/app/components/input/index.tsx index 0c3faed7..7f7185d4 100644 --- a/client/app/components/input/index.tsx +++ b/client/app/components/input/index.tsx @@ -2,6 +2,15 @@ import clsx from "clsx" import React from "react" import styles from "./input.module.css" +type RequireOnlyOne = Pick< + T, + Exclude +> & + { + [K in Keys]-?: Required> & + Partial, undefined>> + }[Keys] + type Props = React.HTMLProps & { label?: string width?: number | string @@ -9,8 +18,10 @@ type Props = React.HTMLProps & { labelClassName?: string } +type InputProps = RequireOnlyOne + // eslint-disable-next-line react/display-name -const Input = React.forwardRef( +const Input = React.forwardRef( ({ label, className, width, height, labelClassName, ...props }, ref) => { return (