Files
youtube-generator/src/components/ui/Textarea.tsx
T
poli0981andClaude Opus 4.6 a763f7c78a feat: Phase 1 MVP scaffold — core engine, i18n, UI, CI/CD
Complete Phase 1 implementation of YTDescGen:
- Project setup: Vite 5 + React 18 + TypeScript strict + Tailwind CSS dark theme
- Config layer: 7 video types, 10 genres, 7 platforms, rig/social fields
- i18n: EN/VI/JA with separate UI and template namespaces + validation script
- Core engine: title-builder, description-builder, tag-generator (pure TS, zero React)
- 42 unit tests covering all engine functions
- Zustand stores: editor + settings with localStorage persistence
- UI: 6 primitives, 11 editor components, 4 output components, 3 layout components
- Pages: Editor (form + quick preview) and Output (title/desc/tags + copy)
- CI/CD: GitHub Actions for lint/typecheck/test/build + GitHub Pages deploy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 21:46:59 +07:00

36 lines
1.1 KiB
TypeScript

import { forwardRef, type TextareaHTMLAttributes } from "react";
import clsx from "clsx";
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
label?: string;
error?: boolean;
}
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
({ label, error, className, id, ...props }, ref) => {
const inputId = id ?? label?.toLowerCase().replace(/\s+/g, "-");
return (
<div className="flex flex-col gap-1">
{label && (
<label htmlFor={inputId} className="text-sm font-medium text-text-secondary">
{label}
</label>
)}
<textarea
ref={ref}
id={inputId}
className={clsx(
"min-h-[80px] rounded-lg border bg-surface-1 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted transition-colors focus:outline-none focus:ring-2 focus:ring-accent/50 resize-y",
error ? "border-danger" : "border-border focus:border-accent",
className,
)}
{...props}
/>
</div>
);
},
);
Textarea.displayName = "Textarea";