File tree Expand file tree Collapse file tree 3 files changed +63
-0
lines changed
Expand file tree Collapse file tree 3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 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 } ;
Original file line number Diff line number Diff line change 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 } ;
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments