'use client'
import { useState } from 'react'
export function FormSection({ title, children }: { title: string; children: React.ReactNode }) {
return (
{title}
{children}
)
}
export function FormField({ label, children }: { label: string; children: React.ReactNode }) {
return (
{children}
)
}
export function MultiTextInput({ values, onChange, placeholder }: { values: string[]; onChange: (v: string[]) => void; placeholder?: string }) {
const [input, setInput] = useState('')
const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === 'Enter' && input.trim()) {
e.preventDefault()
onChange([...values, input.trim()])
setInput('')
}
}
return (
{values.map((v, i) => (
{v}
))}
setInput(e.target.value)}
onKeyDown={handleKeyDown}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent"
placeholder={placeholder}
/>
)
}
export function CheckboxGrid({ options, selected, onChange }: {
options: { value: string; label: string; highlight?: boolean }[]
selected: string[]
onChange: (v: string[]) => void
}) {
const toggle = (value: string) => {
if (selected.includes(value)) {
onChange(selected.filter(v => v !== value))
} else {
onChange([...selected, value])
}
}
return (
{options.map(opt => (
))}
)
}