From 58a23b076891717d9ecf7b3729b54b45e2738e8a Mon Sep 17 00:00:00 2001 From: Defectink Date: Mon, 7 Mar 2022 15:49:54 +0800 Subject: [PATCH] Fix error positon property * remove useless prop types --- components/RUA/RUAInput.tsx | 26 +++++++++++--------------- layouts/MainLayout.tsx | 2 +- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/components/RUA/RUAInput.tsx b/components/RUA/RUAInput.tsx index 8e0afc1..2bd1a01 100644 --- a/components/RUA/RUAInput.tsx +++ b/components/RUA/RUAInput.tsx @@ -1,22 +1,17 @@ -import { - ChangeEventHandler, - HTMLInputTypeAttribute, - KeyboardEventHandler, - forwardRef, -} from 'react'; +import { forwardRef, DetailedHTMLProps, InputHTMLAttributes } from 'react'; import cn from 'classnames'; -interface Props { - className?: string; - placeholder?: string; - value?: string | number | readonly string[] | undefined; - type?: HTMLInputTypeAttribute | undefined; - onChange?: ChangeEventHandler | undefined; - onKeyUp?: KeyboardEventHandler | undefined; -} +interface Props + extends DetailedHTMLProps< + InputHTMLAttributes, + HTMLInputElement + > {} const RUAInput = forwardRef( - ({ className, placeholder, value, onChange, onKeyUp, type }, ref) => { + ( + { className, placeholder, value, onChange, onKeyUp, type, ...rest }, + ref + ) => { return ( <> ( value={value} onChange={onChange} onKeyUp={onKeyUp} + {...rest} /> ); diff --git a/layouts/MainLayout.tsx b/layouts/MainLayout.tsx index 1ddb123..bbe4b8b 100644 --- a/layouts/MainLayout.tsx +++ b/layouts/MainLayout.tsx @@ -22,7 +22,7 @@ const MainLayout: FC = ({ children }) => { >