diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2025-03-04 04:32:50 -0500 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2025-03-04 04:32:50 -0500 |
commit | 95abdada5a275fc258fa72781f7f3c40c0b306ea (patch) | |
tree | 6d729cebe0937ae81108005de9895b5398d1f475 /src/client/views/newlightbox/components/EditableText/EditableText.tsx | |
parent | 0a8f3739cf5c30852f18751a4c05d81e0dabe928 (diff) | |
parent | 215ad40efa2e343e290d18bffbc55884829f1a0d (diff) |
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into Merge
Diffstat (limited to 'src/client/views/newlightbox/components/EditableText/EditableText.tsx')
-rw-r--r-- | src/client/views/newlightbox/components/EditableText/EditableText.tsx | 73 |
1 files changed, 21 insertions, 52 deletions
diff --git a/src/client/views/newlightbox/components/EditableText/EditableText.tsx b/src/client/views/newlightbox/components/EditableText/EditableText.tsx index e9e7ca264..cff84e990 100644 --- a/src/client/views/newlightbox/components/EditableText/EditableText.tsx +++ b/src/client/views/newlightbox/components/EditableText/EditableText.tsx @@ -1,16 +1,16 @@ -import * as React from 'react' -import './EditableText.scss' -import { Size } from 'browndash-components' +import * as React from 'react'; +import './EditableText.scss'; +import { Size } from '@dash/components'; export interface IEditableTextProps { - text: string - placeholder?: string - editing: boolean - onEdit: (newText: string) => void - setEditing: (editing: boolean) => void - backgroundColor?: string - size?: Size - height?: number + text: string; + placeholder?: string; + editing: boolean; + onEdit: (newText: string) => void; + setEditing: (editing: boolean) => void; + backgroundColor?: string; + size?: Size; + height?: number; } /** @@ -20,46 +20,15 @@ export interface IEditableTextProps { * @returns */ export const EditableText = (props: IEditableTextProps) => { - const { - editing, - height, - size, - text, - onEdit, - setEditing, - backgroundColor, - placeholder, - } = props + const { editing, height, text, onEdit, setEditing, backgroundColor, placeholder } = props; - const handleOnChange = (event: React.ChangeEvent<HTMLInputElement>) => { - onEdit(event.target.value) - } + const handleOnChange = (event: React.ChangeEvent<HTMLInputElement>) => { + onEdit(event.target.value); + }; - return editing ? ( - <input - style={{ background: backgroundColor, height: height }} - placeholder={placeholder} - size={1} - className="lb-editableText" - autoFocus - onChange={handleOnChange} - onBlur={() => setEditing(false)} - defaultValue={text} - ></input> - ) : ( - <input - style={{ background: backgroundColor, height: height }} - placeholder={placeholder} - size={1} - className="lb-editableText" - autoFocus - onChange={handleOnChange} - onBlur={() => setEditing(false)} - defaultValue={text} - ></input> - // <div className="lb-displayText" onClick={(e) => { - // e.stopPropagation() - // setEditing(true) - // }}>{text}</div> - ) -} + return editing ? ( + <input style={{ background: backgroundColor, height: height }} placeholder={placeholder} size={1} className="lb-editableText" autoFocus onChange={handleOnChange} onBlur={() => setEditing(false)} defaultValue={text}></input> + ) : ( + <input style={{ background: backgroundColor, height: height }} placeholder={placeholder} size={1} className="lb-editableText" autoFocus onChange={handleOnChange} onBlur={() => setEditing(false)} defaultValue={text}></input> + ); +}; |