Merge pull request #2274 from automatisch/make-editabletypography-consistent
feat(EditableTypography): make icon size and position consistent
This commit is contained in:
@@ -10,9 +10,8 @@ function EditableTypography(props) {
|
|||||||
const {
|
const {
|
||||||
children,
|
children,
|
||||||
onConfirm = noop,
|
onConfirm = noop,
|
||||||
iconPosition = 'start',
|
|
||||||
iconSize = 'large',
|
|
||||||
sx,
|
sx,
|
||||||
|
iconColor = 'inherit',
|
||||||
disabled = false,
|
disabled = false,
|
||||||
prefixValue = '',
|
prefixValue = '',
|
||||||
...typographyProps
|
...typographyProps
|
||||||
@@ -86,14 +85,10 @@ function EditableTypography(props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={sx} onClick={handleClick} editing={editing} disabled={disabled}>
|
<Box sx={sx} onClick={handleClick} editing={editing} disabled={disabled}>
|
||||||
{!disabled && iconPosition === 'start' && editing === false && (
|
|
||||||
<EditIcon fontSize={iconSize} sx={{ mr: 1 }} />
|
|
||||||
)}
|
|
||||||
|
|
||||||
{component}
|
{component}
|
||||||
|
|
||||||
{!disabled && iconPosition === 'end' && editing === false && (
|
{!disabled && editing === false && (
|
||||||
<EditIcon fontSize={iconSize} sx={{ ml: 1 }} />
|
<EditIcon fontSize="small" color={iconColor} sx={{ ml: 1 }} />
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
@@ -102,8 +97,7 @@ function EditableTypography(props) {
|
|||||||
EditableTypography.propTypes = {
|
EditableTypography.propTypes = {
|
||||||
children: PropTypes.string.isRequired,
|
children: PropTypes.string.isRequired,
|
||||||
disabled: PropTypes.bool,
|
disabled: PropTypes.bool,
|
||||||
iconPosition: PropTypes.oneOf(['start', 'end']),
|
iconColor: PropTypes.oneOf(['action', 'inherit']),
|
||||||
iconSize: PropTypes.oneOf(['small', 'large']),
|
|
||||||
onConfirm: PropTypes.func,
|
onConfirm: PropTypes.func,
|
||||||
prefixValue: PropTypes.string,
|
prefixValue: PropTypes.string,
|
||||||
sx: PropTypes.object,
|
sx: PropTypes.object,
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ export default function EditorLayout() {
|
|||||||
variant="body1"
|
variant="body1"
|
||||||
onConfirm={onFlowNameUpdate}
|
onConfirm={onFlowNameUpdate}
|
||||||
noWrap
|
noWrap
|
||||||
|
iconColor="action"
|
||||||
sx={{ display: 'flex', flex: 1, maxWidth: '50vw', ml: 2 }}
|
sx={{ display: 'flex', flex: 1, maxWidth: '50vw', ml: 2 }}
|
||||||
>
|
>
|
||||||
{flow?.name}
|
{flow?.name}
|
||||||
|
|||||||
Reference in New Issue
Block a user