From f1dd7c38adac1cc60a23b94770cd2c1616f31ab4 Mon Sep 17 00:00:00 2001 From: saeed0920 Date: Tue, 16 Sep 2025 22:06:39 +0330 Subject: [PATCH] add new componenet for refactors --- app/components/ui/CustomCheckBox.tsx | 33 +++++++++++++ app/components/ui/base-card.tsx | 42 +++++++++++++++++ app/components/ui/dialog.tsx | 4 +- app/components/ui/form-field.tsx | 61 +++++-------------------- app/components/ui/funnel-chart.test.tsx | 39 ---------------- app/components/ui/metric-card.tsx | 48 +++++++++++++++++++ 6 files changed, 137 insertions(+), 90 deletions(-) create mode 100644 app/components/ui/CustomCheckBox.tsx create mode 100644 app/components/ui/base-card.tsx delete mode 100644 app/components/ui/funnel-chart.test.tsx create mode 100644 app/components/ui/metric-card.tsx diff --git a/app/components/ui/CustomCheckBox.tsx b/app/components/ui/CustomCheckBox.tsx new file mode 100644 index 0000000..a71fe0f --- /dev/null +++ b/app/components/ui/CustomCheckBox.tsx @@ -0,0 +1,33 @@ +import { useId } from "react"; + +interface CheckboxProps { + checked: boolean; + disabled?: boolean; + onChange?: (checked: boolean) => void; + className?: string; + id ?:string; +} + +export default function CustomCheckBox({ + checked, + disabled = false, + onChange, + className = "", + id +}: CheckboxProps) { + + const handleChange = (e: any) => { + onChange?.(e.target.checked); + }; + + return ( + + ); +} diff --git a/app/components/ui/base-card.tsx b/app/components/ui/base-card.tsx new file mode 100644 index 0000000..0aacd39 --- /dev/null +++ b/app/components/ui/base-card.tsx @@ -0,0 +1,42 @@ +import { cn } from "~/lib/utils"; +import { Card, CardContent, CardHeader, CardTitle } from "./card"; + +interface BaseCardProps { + title?: string; + className?: string; + headerClassName?: string; + contentClassName?: string; + children: React.ReactNode; + withHeader?: boolean; +} + +export function BaseCard({ + title, + className, + headerClassName, + contentClassName, + children, + withHeader = false, +}: BaseCardProps) { + return ( + + {withHeader && title ? ( + + {title} + + ) : title ? ( +
+

{title}

+
+ ) : null} + + {children} + +
+ ); +} \ No newline at end of file diff --git a/app/components/ui/dialog.tsx b/app/components/ui/dialog.tsx index 2958cae..a15e864 100644 --- a/app/components/ui/dialog.tsx +++ b/app/components/ui/dialog.tsx @@ -44,8 +44,8 @@ const DialogContent = React.forwardRef< {...props} > {children} - - + + Close diff --git a/app/components/ui/form-field.tsx b/app/components/ui/form-field.tsx index 074ae64..55d8224 100644 --- a/app/components/ui/form-field.tsx +++ b/app/components/ui/form-field.tsx @@ -3,6 +3,7 @@ import { cn } from "~/lib/utils"; import { Eye, EyeOff, AlertCircle, CheckCircle2 } from "lucide-react"; import { Input } from "./input"; import { Label } from "./label"; +import CustomCheckbox from "./CustomCheckBox"; interface BaseFieldProps { label?: string; @@ -65,12 +66,6 @@ export function TextField({ )}
- {leftIcon && ( -
- {leftIcon} -
- )} - - {(rightIcon || hasError || hasSuccess) && ( -
- {hasError ? ( - - ) : hasSuccess ? ( - - ) : ( - rightIcon && ( - {rightIcon} - ) - )} -
- )}
- {error && ( -

- - {error} -

- )} - {helper && !error && (

{helper}

)} @@ -217,17 +187,19 @@ export function PasswordField({ autoComplete={autoComplete} minLength={minLength} className={cn( - "w-full h-12 px-4 pl-10 font-persian text-right transition-all duration-200", + "w-full h-12 px-4 pl-10 bg-white text-base text-[#5F6284] font-persian text-right transition-all duration-200", hasError && "border-destructive focus:border-destructive focus:ring-destructive/20", className, )} + style={{boxShadow : "none"}} + />