Skip to content

Commit

Permalink
Merge pull request #35879 from appsmithorg/hotfix/edit-icon
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhi-nair committed Aug 26, 2024
2 parents 15ff97a + 27d7925 commit 64ebe15
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from "@blueprintjs/core";
import styled from "styled-components";
import type { noop } from "lodash";
import { Spinner } from "@appsmith/ads";
import { Icon, Spinner } from "@appsmith/ads";
import { Text, TextType } from "../index";
import type { CommonComponentProps } from "../types/common";

Expand Down Expand Up @@ -217,6 +217,17 @@ export const EditableTextSubComponent = React.forwardRef(
[inputValidation, onTextChanged],
);

const iconName =
!isEditing &&
savingState === SavingState.NOT_STARTED &&
!props.hideEditIcon
? "pencil-line"
: !isEditing && savingState === SavingState.SUCCESS
? "success"
: savingState === SavingState.ERROR || (isEditing && !!isInvalid)
? "error"
: undefined;

return (
<>
<TextContainer
Expand All @@ -240,7 +251,11 @@ export const EditableTextSubComponent = React.forwardRef(
value={value}
/>

{savingState === SavingState.STARTED ? <Spinner size="md" /> : null}
{savingState === SavingState.STARTED ? (
<Spinner size="md" />
) : value && !props.hideEditIcon && iconName ? (
<Icon name={iconName} size="md" />
) : null}
</TextContainer>
{isEditing && !!isInvalid ? (
<Text className="error-message" type={TextType.P2}>
Expand Down

0 comments on commit 64ebe15

Please sign in to comment.