EnxDev commented on code in PR #33090:
URL: https://github.com/apache/superset/pull/33090#discussion_r2054463294
##########
superset-frontend/src/components/DynamicEditableTitle/index.tsx:
##########
@@ -176,38 +166,28 @@ export const DynamicEditableTitle = memo(
showTooltip && currentTitle && !isEditing ? currentTitle : null
}
>
- {canEdit ? (
- <input
- data-test="editable-title-input"
- className="dynamic-title-input"
- aria-label={label ?? t('Title')}
- ref={contentRef}
- onChange={handleChange}
- onBlur={handleBlur}
- onClick={handleClick}
- onKeyPress={handleKeyPress}
- placeholder={placeholder}
- value={currentTitle}
- css={css`
- cursor: ${isEditing ? 'text' : 'pointer'};
-
- ${inputWidth &&
- inputWidth > 0 &&
- css`
- width: ${inputWidth + 1}px;
- `}
+ <Input
+ data-test="editable-title-input"
+ variant="borderless"
+ aria-label={label ?? t('Title')}
+ className="dynamic-title-input"
+ value={currentTitle}
+ onChange={handleChange}
+ onBlur={handleBlur}
+ onClick={handleClick}
+ onPressEnter={handleKeyPress}
+ placeholder={placeholder}
+ css={css`
+ font-size: ${theme.fontSizeXL}px;
+ transition: auto;
+ ${inputWidth &&
+ inputWidth > 0 &&
+ css`
+ width: ${inputWidth}px;
`}
- />
- ) : (
- <span
- className="dynamic-title"
- aria-label={label ?? t('Title')}
- ref={contentRef}
- data-test="editable-title"
- >
- {currentTitle}
- </span>
- )}
+ `}
+ disabled={!canEdit}
+ />
Review Comment:
In my case, I'm using the Input component — it maintains the same
functionality and appearance we had before. Using Typography would introduce
more complexity, including a state to manage and an icon inside the field, and
I'm not sure it's necessary in this case. @geido @kasiazjc what do you think
about that? Should we provide a separate PR to add this logic inside editable
fields?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]