fix: update component interfaces and props
Input Component: - Add icon prop to support icon display Typography Component: - Add actions prop to FormHeader for flexible action buttons Modal Usage: - Add required title prop to Modal components in Users pages UserForm Component: - Add missing props: initialData, onCancel, loading, isEdit - Support both defaultValues and initialData patterns These changes resolve TS2741 and TS2322 type errors
This commit is contained in:
parent
57287c866c
commit
e0156658a2
|
|
@ -7,6 +7,7 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, '
|
||||||
error?: string;
|
error?: string;
|
||||||
helperText?: string;
|
helperText?: string;
|
||||||
inputSize?: 'sm' | 'md' | 'lg';
|
inputSize?: 'sm' | 'md' | 'lg';
|
||||||
|
icon?: React.ComponentType<{ className?: string }>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,11 @@ interface FormHeaderProps {
|
||||||
title: string;
|
title: string;
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
backButton?: React.ReactNode;
|
backButton?: React.ReactNode;
|
||||||
|
actions?: React.ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FormHeader = ({ title, subtitle, backButton, className = '' }: FormHeaderProps) => (
|
export const FormHeader = ({ title, subtitle, backButton, actions, className = '' }: FormHeaderProps) => (
|
||||||
<div className={`space-y-3 sm:space-y-4 ${className}`}>
|
<div className={`space-y-3 sm:space-y-4 ${className}`}>
|
||||||
{/* Mobile: Stack vertically, Desktop: Side by side */}
|
{/* Mobile: Stack vertically, Desktop: Side by side */}
|
||||||
<div className="flex flex-col space-y-3 sm:flex-row sm:items-center sm:gap-4 sm:space-y-0">
|
<div className="flex flex-col space-y-3 sm:flex-row sm:items-center sm:gap-4 sm:space-y-0">
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,7 @@ export const Users = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
|
title={editingUser ? "ویرایش کاربر" : "افزودن کاربر"}
|
||||||
isOpen={showUserModal}
|
isOpen={showUserModal}
|
||||||
onClose={handleCloseModal}
|
onClose={handleCloseModal}
|
||||||
size="lg"
|
size="lg"
|
||||||
|
|
|
||||||
|
|
@ -233,6 +233,7 @@ const Users = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
|
title={editingUser ? "ویرایش کاربر" : "افزودن کاربر"}
|
||||||
isOpen={showUserModal}
|
isOpen={showUserModal}
|
||||||
onClose={handleCloseModal}
|
onClose={handleCloseModal}
|
||||||
size="lg"
|
size="lg"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue