-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
applying composition patterns to Input
- Loading branch information
1 parent
c81ba4b
commit eb4a339
Showing
6 changed files
with
48 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export interface ControlProps {} | ||
import { ComponentProps } from 'react' | ||
|
||
export type ControlProps = ComponentProps<'input'> | ||
|
||
export function Control(props: ControlProps) { | ||
return <div></div> | ||
return <input type="file" className="sr-only" id="photo" {...props}></input> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
export interface ImagePreviewProps {} | ||
import { User } from 'lucide-react' | ||
|
||
export function ImagePreview(props: ImagePreviewProps) { | ||
return <div></div> | ||
export function ImagePreview() { | ||
return ( | ||
<div className="bg-violet-50 flex size-16 items-center justify-center rounded-full"> | ||
<User className="size-8 text-violet-500" /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export interface RootProps {} | ||
import { ComponentProps } from 'react' | ||
|
||
export type RootProps = ComponentProps<'div'> | ||
|
||
export function Root(props: RootProps) { | ||
return <div></div> | ||
return <div {...props}></div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
export interface TriggerProps {} | ||
import { UploadCloud } from 'lucide-react' | ||
|
||
export function Trigger(props: TriggerProps) { | ||
return <div></div> | ||
export function Trigger() { | ||
return ( | ||
<label | ||
htmlFor="photo" | ||
className="group flex-1 cursor-pointer flex flex-col items-center gap-3 rounded-lg border border-zinc-300 px-6 py-4 text-center text-zinc-500 shadow-lg hover:border-violet-200 hover:bg-violet-25 hover:text-violet-500" | ||
> | ||
Selecionar arquivo | ||
<div className="rounded-full border-6 border-zinc-50 bg-zinc-100 p-2 group-hover:border-violet-50 group-hover:bg-violet-100"> | ||
<UploadCloud className="size-5 text-zinc-600 group-hover:text-violet-600" /> | ||
</div> | ||
<div className="flex flex-col items-center gap-1"> | ||
<span className="text-sm"> | ||
<span className="font-semibold text-violet-700">Click to upload</span>{' '} | ||
or drag and drop | ||
</span> | ||
<span className="text-xs">SVG, PNG, JPG or GIF (max, 800x400px)</span> | ||
</div> | ||
</label> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Control } from './Control' | ||
import { ImagePreview } from './ImagePreview' | ||
import { Root } from './Root' | ||
import { Trigger } from './Trigger' | ||
|
||
export { Control, ImagePreview, Root, Trigger } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters