mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-15 12:13:38 +00:00
(fix:input) remove ambiguous label prop
This commit is contained in:
1 parent
25dfd63c4f
commit
71e45860f3
1 file changed
+12
-13
@@ -8,13 +8,13 @@ const Input = ({
|
|||||||
value,
|
value,
|
||||||
isAutoFocused = false,
|
isAutoFocused = false,
|
||||||
placeholder,
|
placeholder,
|
||||||
label,
|
|
||||||
required = false,
|
required = false,
|
||||||
maxLength,
|
maxLength,
|
||||||
className,
|
className = '',
|
||||||
colorVariant = 'silver',
|
colorVariant = 'silver',
|
||||||
borderVariant = 'thick',
|
borderVariant = 'thick',
|
||||||
children,
|
children,
|
||||||
|
labelBgClassName = 'bg-white dark:bg-raisin-black',
|
||||||
onChange,
|
onChange,
|
||||||
onPaste,
|
onPaste,
|
||||||
onKeyDown,
|
onKeyDown,
|
||||||
@@ -32,15 +32,15 @@ const Input = ({
|
|||||||
const inputRef = useRef<HTMLInputElement>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className={`relative ${className}`}>
|
||||||
<input
|
<input
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
className={`peer h-[42px] w-full rounded-full px-3 py-1 outline-none dark:bg-transparent dark:text-white placeholder-transparent ${className} ${colorStyles[colorVariant]} ${borderStyles[borderVariant]}`}
|
className={`peer h-[42px] w-full rounded-full px-3 py-1 bg-transparent outline-none dark:text-white placeholder-transparent ${colorStyles[colorVariant]} ${borderStyles[borderVariant]}`}
|
||||||
type={type}
|
type={type}
|
||||||
id={id}
|
id={id}
|
||||||
name={name}
|
name={name}
|
||||||
autoFocus={isAutoFocused}
|
autoFocus={isAutoFocused}
|
||||||
placeholder={placeholder || label || ''}
|
placeholder={placeholder || ''}
|
||||||
maxLength={maxLength}
|
maxLength={maxLength}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
@@ -50,17 +50,16 @@ const Input = ({
|
|||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</input>
|
</input>
|
||||||
{(label || placeholder) && (
|
{placeholder && (
|
||||||
<label
|
<label
|
||||||
htmlFor={id}
|
htmlFor={id}
|
||||||
className={`absolute left-3 -top-2.5 bg-white px-2 text-xs transition-all
|
className={`absolute left-3 -top-2.5 px-2 text-xs transition-all
|
||||||
peer-placeholder-shown:top-2.5 peer-placeholder-shown:left-3
|
peer-placeholder-shown:top-2.5 peer-placeholder-shown:left-3 peer-placeholder-shown:text-base
|
||||||
peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-4000
|
peer-placeholder-shown:text-gray-4000 peer-focus:-top-2.5 peer-focus:left-3 peer-focus:text-xs
|
||||||
peer-focus:-top-2.5 peer-focus:left-3 peer-focus:text-xs peer-focus:text-gray-4000
|
peer-focus:text-gray-4000 dark:text-silver dark:peer-placeholder-shown:text-gray-400
|
||||||
dark:bg-[#26272E] dark:text-silver dark:peer-placeholder-shown:text-gray-400
|
cursor-none pointer-events-none ${labelBgClassName}`}
|
||||||
cursor-none pointer-events-none`}
|
|
||||||
>
|
>
|
||||||
{label || placeholder}
|
{placeholder}
|
||||||
{required && (
|
{required && (
|
||||||
<span className="text-[#D30000] dark:text-[#D42626] ml-0.5">*</span>
|
<span className="text-[#D30000] dark:text-[#D42626] ml-0.5">*</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in new issue
Block a user