diff --git a/src/components/Checkbox.tsx b/src/components/Checkbox.tsx index 4122186..dda9f12 100644 --- a/src/components/Checkbox.tsx +++ b/src/components/Checkbox.tsx @@ -1,11 +1,10 @@ import React, { forwardRef } from 'react' import { twMerge } from 'tailwind-merge' -export interface CheckboxProps { +import ErrorMessage from './ErrorMessage' + +type CheckboxProps = Omit, "type"> & { error?: string - name: string label: string - disabled?: boolean - className?: string } const Checkbox = forwardRef( @@ -50,8 +49,8 @@ const Checkbox = forwardRef(
- {/* {error} */} + {error && {error}} ), ) diff --git a/src/components/ErrorMessage.tsx b/src/components/ErrorMessage.tsx index e954727..f75b17d 100644 --- a/src/components/ErrorMessage.tsx +++ b/src/components/ErrorMessage.tsx @@ -1,11 +1,8 @@ -import React, { ReactNode } from 'react' +import React from 'react' +import { twMerge } from 'tailwind-merge' -interface ErrorMessageProps { - children: ReactNode -} - -const ErrorMessage = ({ children }: ErrorMessageProps) => { - return

{children}

+const ErrorMessage = ({ children, className }: React.HTMLAttributes) => { + return

{children}

} export default ErrorMessage diff --git a/src/components/IconButton.tsx b/src/components/IconButton.tsx index 2e56d4c..4df3fbe 100644 --- a/src/components/IconButton.tsx +++ b/src/components/IconButton.tsx @@ -1,6 +1,6 @@ import React, { ReactNode } from 'react' -export interface IconButtonProps { +export interface IconButtonProps extends React.HtmlHTMLAttributes { icon: ReactNode } diff --git a/src/components/Input.tsx b/src/components/Input.tsx index 39026a0..ee7ce10 100644 --- a/src/components/Input.tsx +++ b/src/components/Input.tsx @@ -1,11 +1,9 @@ import React, { forwardRef } from 'react' import ErrorMessage from './ErrorMessage' -export interface InputProps { +type InputProps = Omit, "type"> & { error?: string label?: string - name: string - className?: string } const Input = forwardRef( @@ -13,7 +11,7 @@ const Input = forwardRef( return (
{label && ( -