mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-23 15:14:23 +00:00
19 lines
No EOL
521 B
TypeScript
19 lines
No EOL
521 B
TypeScript
import { HTMLProps } from "react";
|
|
import { Editable } from "./Editable";
|
|
|
|
|
|
/**
|
|
* Controlled input component which displays an `input[type="text"]` in editing mode, and a `span` displaying the input in preview mode.
|
|
*/
|
|
export function EditableText(props: HTMLProps<HTMLInputElement> & { value: string }) {
|
|
return (
|
|
<Editable
|
|
editing={
|
|
<input type="text" {...props} />
|
|
}
|
|
preview={
|
|
<span>{props.value}</span>
|
|
}
|
|
/>
|
|
)
|
|
} |