feat(labeled-input): add Big labeled input field
This commit is contained in:
parent
dcf89a1e57
commit
7bccd3405d
2 changed files with 10 additions and 5 deletions
|
@ -7,7 +7,7 @@ export default function LabeledInput({
|
||||||
placeholder,
|
placeholder,
|
||||||
value,
|
value,
|
||||||
name,
|
name,
|
||||||
big = false, // Add a prop for the bigger variant, default is false
|
size = 'default',
|
||||||
autocomplete,
|
autocomplete,
|
||||||
error,
|
error,
|
||||||
...rest
|
...rest
|
||||||
|
@ -17,14 +17,14 @@ export default function LabeledInput({
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
big?: boolean; // Optional prop for bigger input
|
size?: 'default' | 'big' | 'textarea';
|
||||||
autocomplete?: string;
|
autocomplete?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
} & React.InputHTMLAttributes<HTMLInputElement>) {
|
} & React.InputHTMLAttributes<HTMLInputElement>) {
|
||||||
return (
|
return (
|
||||||
<div className='grid grid-cols-1 gap-1'>
|
<div className='grid grid-cols-1 gap-1'>
|
||||||
<Label htmlFor={name}>{label}</Label>
|
<Label htmlFor={name}>{label}</Label>
|
||||||
{big ? (
|
{size === 'textarea' ? (
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
defaultValue={value}
|
defaultValue={value}
|
||||||
|
@ -39,6 +39,11 @@ export default function LabeledInput({
|
||||||
defaultValue={value}
|
defaultValue={value}
|
||||||
id={name}
|
id={name}
|
||||||
name={name}
|
name={name}
|
||||||
|
className={
|
||||||
|
size === 'big'
|
||||||
|
? 'h-12 file:h-10 text-lg gplaceholder:text-lg sm:text-2xl sm:placeholder:text-2xl'
|
||||||
|
: ''
|
||||||
|
}
|
||||||
autoComplete={autocomplete}
|
autoComplete={autocomplete}
|
||||||
{...rest}
|
{...rest}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -9,7 +9,7 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
||||||
data-slot='input'
|
data-slot='input'
|
||||||
className={cn(
|
className={cn(
|
||||||
/* Text */
|
/* Text */
|
||||||
'text-text-input selection:text-text md:text-sm file:text-destructive file:text-sm placeholder:text-text-muted-input',
|
'text-text-input selection:text-text file:text-destructive file:text-sm placeholder:text-text-muted-input',
|
||||||
/* Background */
|
/* Background */
|
||||||
'bg-transparent selection:bg-muted-input file:bg-transparent',
|
'bg-transparent selection:bg-muted-input file:bg-transparent',
|
||||||
/* Border */
|
/* Border */
|
||||||
|
@ -52,7 +52,7 @@ function Textarea({
|
||||||
rows={rows}
|
rows={rows}
|
||||||
className={cn(
|
className={cn(
|
||||||
/* Text */
|
/* Text */
|
||||||
'text-text-input selection:text-text md:text-sm placeholder:text-text-muted-input',
|
'text-text-input selection:text-text placeholder:text-text-muted-input',
|
||||||
/* Background */
|
/* Background */
|
||||||
'bg-transparent selection:bg-muted-input',
|
'bg-transparent selection:bg-muted-input',
|
||||||
/* Border */
|
/* Border */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue