import * as React from 'react' import './EditableText.scss' import { Size } from 'browndash-components' export interface IEditableTextProps { text: string placeholder?: string editing: boolean onEdit: (newText: string) => void setEditing: (editing: boolean) => void backgroundColor?: string size?: Size height?: number } /** * Editable Text is used for inline renaming of some text. * It appears as normal UI text but transforms into a text input field when the user clicks on or focuses it. * @param props * @returns */ export const EditableText = (props: IEditableTextProps) => { const { editing, height, size, text, onEdit, setEditing, backgroundColor, placeholder, } = props const handleOnChange = (event: React.ChangeEvent) => { onEdit(event.target.value) } return editing ? ( setEditing(false)} defaultValue={text} > ) : ( setEditing(false)} defaultValue={text} > //
{ // e.stopPropagation() // setEditing(true) // }}>{text}
) }