Skip to content

Commit 3e4da5a

Browse files
committed
feat: fixed frontend build and foramat check
1 parent 95ba8d2 commit 3e4da5a

File tree

325 files changed

+241862
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+241862
-9
lines changed

frontend/components/ui/button.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ const buttonVariants = cva(
1111
variant: {
1212
default:
1313
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
14+
primary:
15+
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
1416
destructive:
1517
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
1618
outline:
1719
"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
1820
secondary:
1921
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
22+
tertiary:
23+
"bg-muted text-muted-foreground shadow-sm hover:bg-muted/80",
2024
ghost: "hover:bg-accent hover:text-accent-foreground",
2125
link: "text-primary underline-offset-4 hover:underline",
2226
},
@@ -25,6 +29,9 @@ const buttonVariants = cva(
2529
sm: "h-8 rounded-md px-3 text-xs",
2630
lg: "h-10 rounded-md px-8",
2731
icon: "h-9 w-9",
32+
small: "h-8 rounded-md px-3 text-xs",
33+
medium: "h-9 px-4 py-2",
34+
large: "h-10 rounded-md px-8",
2835
},
2936
},
3037
defaultVariants: {
@@ -36,19 +43,28 @@ const buttonVariants = cva(
3643

3744
export interface ButtonProps
3845
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
39-
VariantProps<typeof buttonVariants> {
40-
asChild?: boolean
46+
VariantProps<typeof buttonVariants> {
47+
asChild?: boolean;
48+
loading?: boolean;
49+
icon?: React.ReactNode;
50+
iconPosition?: "left" | "right";
4151
}
4252

4353
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
44-
({ className, variant, size, asChild = false, ...props }, ref) => {
54+
({ className, variant, size, asChild = false, loading, icon, iconPosition = "left", children, ...props }, ref) => {
4555
const Comp = asChild ? Slot : "button"
4656
return (
4757
<Comp
4858
className={cn(buttonVariants({ variant, size, className }))}
4959
ref={ref}
60+
disabled={props.disabled || loading}
5061
{...props}
51-
/>
62+
>
63+
{loading && <span className="mr-2 animate-spin"></span>} {/* Simple loading indicator */}
64+
{!loading && icon && iconPosition === "left" && <span className="mr-2">{icon}</span>}
65+
{children}
66+
{!loading && icon && iconPosition === "right" && <span className="ml-2">{icon}</span>}
67+
</Comp>
5268
)
5369
}
5470
)

frontend/components/ui/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Component exports
22
export { Button, buttonVariants, type ButtonProps } from "./button";
3-
export { Input, type InputProps } from "./input";
3+
export { default as Input, type InputProps } from "./input";
44
export { Toast, toastVariants, type ToastProps } from "./toast";
55
export { ToastProvider, useToast } from "./toast-provider";
66
export { Checkbox, type CheckboxProps } from "./checkbox";

frontend/components/ui/input.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import React from "react";
22

3-
interface InputProps {
3+
export interface InputProps {
44
label: string;
55
type?: string;
6-
name: string;
6+
name?: string;
77
id?: string;
88
placeholder?: string;
99
value?: string;
1010
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
1111
error?: string;
12+
helperText?: string;
13+
disabled?: boolean;
1214
}
1315

1416
const Input: React.FC<InputProps> = ({
@@ -20,9 +22,11 @@ const Input: React.FC<InputProps> = ({
2022
value,
2123
onChange,
2224
error,
25+
helperText,
26+
disabled,
2327
}) => {
2428
return (
25-
<div className="flex flex-col h-[72px] cols-span-1 gap-3">
29+
<div className="flex flex-col h-auto min-h-[72px] cols-span-1 gap-3">
2630
<label htmlFor={id || name} className="text-[#8F8F8F]">
2731
{label}
2832
</label>
@@ -34,12 +38,15 @@ const Input: React.FC<InputProps> = ({
3438
placeholder={placeholder}
3539
value={value}
3640
onChange={onChange}
41+
disabled={disabled}
3742
className={`bg-transparent outline-none border-[#373737] border rounded-[8px] text-[16px] font-[400] text-[#CCCCCC] p-3 min-h-[43px]
38-
${error ? "border-red-500" : "border-[#373737]"}`}
43+
${error ? "border-red-500" : "border-[#373737]"}
44+
${disabled ? "opacity-50 cursor-not-allowed" : ""}`}
3945
style={type === "date" ? { WebkitAppearance: "none" } : {}}
4046
/>
4147

4248
{error && <p className="text-red-500 text-sm">{error}</p>}
49+
{helperText && !error && <p className="text-[#8F8F8F] text-sm">{helperText}</p>}
4350
</div>
4451
);
4552
};

0 commit comments

Comments
 (0)