Skip to content

Commit

Permalink
Add ability for NCInputTextField to display red border when invalid i…
Browse files Browse the repository at this point in the history
…nput provided

Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Jul 20, 2023
1 parent f85f9a4 commit 0c55133
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gui/filedetails/NCInputTextField.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ TextField {
readonly property color accentColor: Style.ncBlue
readonly property color secondaryColor: palette.dark
readonly property alias submitButton: submitButton
property bool validInput: true

implicitHeight: Style.talkReplyTextFieldPreferredHeight

Expand All @@ -36,7 +37,7 @@ TextField {
id: textFieldBorder
radius: Style.slightlyRoundedButtonRadius
border.width: Style.normalBorderWidth
border.color: root.activeFocus ? root.accentColor : root.secondaryColor
border.color: root.activeFocus ? root.validInput ? root.accentColor : Style.errorBoxBackgroundColor : root.secondaryColor
color: palette.base
}

Expand All @@ -55,7 +56,7 @@ TextField {
icon.source: "image://svgimage-custom-color/confirm.svg" + "/" + root.secondaryColor
icon.color: hovered && enabled ? UserModel.currentUser.accentColor : root.secondaryColor

enabled: root.text !== ""
enabled: root.text !== "" && root.validInput

onClicked: root.accepted()
}
Expand Down

0 comments on commit 0c55133

Please sign in to comment.