feat: Introduce a generic inline rename input component for document editing
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { CheckIcon, CloseIcon } from '../../ui/icons';
|
||||
|
||||
interface InlineRenameInputProps {
|
||||
interface InlineRenameInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onSubmit' | 'value'> {
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
onSubmit: () => void;
|
||||
@@ -21,11 +21,13 @@ const InlineRenameInput: React.FC<InlineRenameInputProps> = ({
|
||||
canSubmit = true,
|
||||
inputRef,
|
||||
className = 'doc-title-edit',
|
||||
type = 'text',
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<span className={className}>
|
||||
<input
|
||||
type="text"
|
||||
type={type}
|
||||
ref={inputRef}
|
||||
value={value}
|
||||
onChange={(event) => onChange(event.target.value)}
|
||||
@@ -45,6 +47,7 @@ const InlineRenameInput: React.FC<InlineRenameInputProps> = ({
|
||||
onCancel();
|
||||
}
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
Reference in New Issue
Block a user