diff --git a/src/components/input/CheckboxInput.tsx b/src/components/input/CheckboxInput.tsx index 8ee202db..c3c5be0a 100644 --- a/src/components/input/CheckboxInput.tsx +++ b/src/components/input/CheckboxInput.tsx @@ -267,12 +267,13 @@ const CheckboxInput = ({
)} - {/* Field Message */} -{bottomLabel}
+ )} + {isError && errorMessage && ( +{errorMessage}
+ )} ); }; diff --git a/src/components/input/FileInput.tsx b/src/components/input/FileInput.tsx index 285a3f42..6218970c 100644 --- a/src/components/input/FileInput.tsx +++ b/src/components/input/FileInput.tsx @@ -2,7 +2,6 @@ import { Ref } from 'react'; import { cn } from '@/lib/helper'; import { TextInputProps } from '@/components/input/TextInput'; -import FieldMessage from '@/components/helper/FieldMessage'; interface FileInputProps extends Omit< @@ -38,9 +37,6 @@ const FileInput = ({ onBlur, readOnly = false, }: FileInputProps) => { - const showErrorMessage = Boolean(isError && errorMessage); - const feedbackMessage = showErrorMessage ? errorMessage : bottomLabel; - return ( -{bottomLabel}
+ )} + + {isError &&{errorMessage}
} ); }; diff --git a/src/components/input/NumberInput.tsx b/src/components/input/NumberInput.tsx index 4d6a7393..5710e932 100644 --- a/src/components/input/NumberInput.tsx +++ b/src/components/input/NumberInput.tsx @@ -11,67 +11,8 @@ import { import { Icon } from '@iconify/react'; import { cn } from '@/lib/helper'; -import FieldMessage from '@/components/helper/FieldMessage'; -export type MaskType = 'currency' | 'weight' | 'decimal' | 'number'; - -export interface NumberInputProps { - // Basic Props - label?: string; - bottomLabel?: string; - name: string; - value?: number | string; - placeholder?: string; - - // Styling Props - className?: { - wrapper?: string; - label?: string; - inputWrapper?: string; - input?: string; - }; - - // State Props - isError?: boolean; - isValid?: boolean; - errorMessage?: string; - disabled?: boolean; - readOnly?: boolean; - required?: boolean; - isLoading?: boolean; - - // Adornment Props - startAdornment?: ReactNode; - endAdornment?: ReactNode; - - // Event Handlers - onChange?: ChangeEventHandler{bottomLabel}
+ )} + {isError && errorMessage && ( +{errorMessage}
+ )}{bottomLabel}
+ )} + + {/* Pesan error */} + {isError && errorMessage && ( +{errorMessage}
+ )}{errorMessage}
} + {!isError && bottomLabel && ( +{bottomLabel}
+ )}{bottomLabel}
+ )} + {isError &&{errorMessage}
} ); }; diff --git a/src/components/input/TextArea.tsx b/src/components/input/TextArea.tsx index 34644021..6e93811c 100644 --- a/src/components/input/TextArea.tsx +++ b/src/components/input/TextArea.tsx @@ -3,7 +3,6 @@ import { ChangeEventHandler, FocusEventHandler, ReactNode } from 'react'; import { cn } from '@/lib/helper'; -import FieldMessage from '@/components/helper/FieldMessage'; export interface TextAreaProps { label?: string; @@ -51,9 +50,6 @@ const TextArea = ({ isLoading = false, rows = 3, }: TextAreaProps) => { - const showErrorMessage = Boolean(isError && errorMessage); - const feedbackMessage = showErrorMessage ? errorMessage : bottomLabel; - return ({bottomLabel}
+ )} + {isError &&{errorMessage}
}{bottomLabel}
+ )} + {isError && errorMessage && ( +{errorMessage}
+ )}