feat(textarea-component): Textarea mit auto-resize + char-count [tsc:fail]
This commit is contained in:
parent
f086436ec4
commit
9b65f8793d
@ -1,5 +1,8 @@
|
||||
{
|
||||
"completed_features": [],
|
||||
"current_feature": "input-component",
|
||||
"started_at": "2026-05-23T09:58:25.839766"
|
||||
"current_feature": "textarea-component",
|
||||
"started_at": "2026-05-23T09:58:25.839766",
|
||||
"attempted_features": [
|
||||
"input-component"
|
||||
]
|
||||
}
|
||||
@ -3895,3 +3895,21 @@ src/index.ts(27,25): error TS2769: No overload matches this call.
|
||||
Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
|
||||
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>,
|
||||
- `09:58:44` **INFO** Committed feature input-component
|
||||
- `09:58:44` **INFO** Pushed: rc=0
|
||||
|
||||
## Phase-3 Feature: textarea-component (2026-05-23 09:58:44)
|
||||
|
||||
- `09:58:44` **INFO** Description: Textarea mit auto-resize + char-count
|
||||
- `09:58:44` **INFO** Generating apps/web/src/components/Textarea.tsx (Textarea-Component. Props: value, onChange, label?, error?, placeholde…)
|
||||
- `09:59:01` **INFO** wrote 1912 chars in 16.6s (attempt 1)
|
||||
- `09:59:01` **INFO** Running tsc --noEmit on api…
|
||||
- `09:59:03` **WARN** tsc errors:
|
||||
src/db/schema.ts(37,14): error TS7022: 'customers' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
src/db/schema.ts(45,59): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
|
||||
src/db/schema.ts(49,14): error TS7022: 'projects' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
src/db/schema.ts(53,56): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
|
||||
src/index.ts(27,25): error TS2769: No overload matches this call.
|
||||
Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
|
||||
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>,
|
||||
|
||||
72
apps/web/src/components/Textarea.tsx
Normal file
72
apps/web/src/components/Textarea.tsx
Normal file
@ -0,0 +1,72 @@
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
|
||||
interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
||||
label?: string;
|
||||
error?: string;
|
||||
autoResize?: boolean;
|
||||
}
|
||||
|
||||
const Textarea: React.FC<TextareaProps> = ({
|
||||
label,
|
||||
error,
|
||||
placeholder,
|
||||
rows = 4,
|
||||
maxLength,
|
||||
autoResize = false,
|
||||
value,
|
||||
onChange,
|
||||
className = '',
|
||||
...props
|
||||
}) => {
|
||||
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (autoResize && textareaRef.current) {
|
||||
textareaRef.current.style.height = 'auto';
|
||||
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
|
||||
}
|
||||
}, [value, autoResize]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-1.5 w-full">
|
||||
{label && (
|
||||
<label className="text-sm font-medium text-slate-700 dark:text-slate-300">
|
||||
{label}
|
||||
</label>
|
||||
)}
|
||||
|
||||
<div className="relative">
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
placeholder={placeholder}
|
||||
rows={autoResize ? 1 : rows}
|
||||
maxLength={maxLength}
|
||||
className={`
|
||||
w-full px-3 py-2 text-sm bg-white dark:bg-slate-900
|
||||
border rounded-md outline-none transition-colors
|
||||
${error
|
||||
? 'border-red-500 focus:ring-1 focus:ring-red-500'
|
||||
: 'border-slate-300 dark:border-slate-700 focus:border-blue-500 focus:ring-1 focus:ring-blue-500'
|
||||
}
|
||||
${className}
|
||||
`}
|
||||
{...props}
|
||||
/>
|
||||
|
||||
{maxLength && value && (
|
||||
<div className="absolute bottom-2 right-2 text-[10px] text-slate-400 pointer-events-none">
|
||||
{value.length}/{maxLength}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<span className="text-xs text-red-500">{error}</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Textarea;
|
||||
Loading…
Reference in New Issue
Block a user