import { PlusIcon } from '@primer/octicons-react'; import { useState } from 'react'; import tw from 'twin.macro'; interface NewColumnHeaderProps { style: object; onAdd: (name: string) => void; } export function NewColumnHeader(props: NewColumnHeaderProps) { const { style, onAdd } = props; const [isEditing, setIsEditing] = useState(false); const [editedValue, setEditedValue] = useState(''); return ( // @ts-ignore
{isEditing ? (
{ e.preventDefault(); onAdd(editedValue); setIsEditing(false); }}> { e.target.select(); }} tw="w-full h-full py-2 px-2 text-black focus:outline-none bg-white border border-gray-300" value={editedValue} onChange={e => setEditedValue(e.target.value)} onKeyDown={e => { if (e.key === 'Escape') { setIsEditing(false); setEditedValue(''); } }} onBlur={() => { setIsEditing(false); setEditedValue(''); }} />
) : ( )}
) }