writekit/frontends/ui/src/Input.tsx
Josh bef5dd4437 refactor: move studio to frontends workspace
- Move studio from root to frontends/studio/
- Add owner-tools frontend for live blog admin UI
- Add shared ui component library
- Set up npm workspaces for frontends
- Add enhanced code block extension for editor

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 02:06:19 +02:00

50 lines
1.3 KiB
TypeScript

import type { InputHTMLAttributes, TextareaHTMLAttributes } from 'react'
import type { IconComponent } from './Icons'
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
value: string
onChange: (value: string) => void
Icon?: IconComponent
}
interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange'> {
value: string
onChange: (value: string) => void
rows?: number
}
export function Input({ value, onChange, Icon, className = '', ...props }: InputProps) {
if (Icon) {
return (
<div className="relative">
<Icon className="absolute left-3 top-1/2 -translate-y-1/2 text-muted text-sm" />
<input
className={`input pl-9 ${className}`}
value={value}
onChange={e => onChange(e.target.value)}
{...props}
/>
</div>
)
}
return (
<input
className={`input ${className}`}
value={value}
onChange={e => onChange(e.target.value)}
{...props}
/>
)
}
export function Textarea({ value, onChange, rows = 4, className = '', ...props }: TextareaProps) {
return (
<textarea
className={`input resize-none ${className}`}
value={value}
onChange={e => onChange(e.target.value)}
rows={rows}
{...props}
/>
)
}