Skip to content

Commit faa9a61

Browse files
Merge pull request #46 from ekim1394/main
fix: add missing files for frontend
2 parents 2c8892d + 422aa02 commit faa9a61

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import * as React from "react";
2+
3+
import { cn } from "@/lib/utils";
4+
5+
function FileInput({
6+
className,
7+
type,
8+
...props
9+
}: React.ComponentProps<"input">) {
10+
const [selectedFile, setSelectedFile] = React.useState("No file chosen");
11+
12+
const { id, ...rest } = props;
13+
14+
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
15+
if (event.target.files && event.target.files[0]) {
16+
setSelectedFile(event.target.files[0].name);
17+
} else {
18+
setSelectedFile("No file chosen");
19+
}
20+
};
21+
22+
return (
23+
<>
24+
<input
25+
type="file"
26+
data-slot="input"
27+
className={cn(className)}
28+
onChange={handleFileChange}
29+
{...props}
30+
/>
31+
</>
32+
);
33+
}
34+
35+
export { FileInput };
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import * as React from "react";
2+
import * as LabelPrimitive from "@radix-ui/react-label";
3+
4+
import { cn } from "@/lib/utils";
5+
6+
function Label({
7+
className,
8+
...props
9+
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
10+
return (
11+
<LabelPrimitive.Root
12+
data-slot="label"
13+
className={cn(
14+
"mb-2 flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
15+
className
16+
)}
17+
{...props}
18+
/>
19+
);
20+
}
21+
22+
export { Label };

frontend/src/lib/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { clsx, type ClassValue } from "clsx"
2+
import { twMerge } from "tailwind-merge"
3+
4+
export function cn(...inputs: ClassValue[]) {
5+
return twMerge(clsx(inputs))
6+
}

0 commit comments

Comments
 (0)