From ea2238f998a21d64f1e3a152cf3ccf11de312377 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Fri, 29 Jan 2021 11:00:37 +0100 Subject: [PATCH] uiux(StatusTimeline): fix send button look & feel Due to how `StatusButton` has evolved, the send button in the Status timeline no longer looked and behaved the way it was supposed to. This commit patches that by introducing new properties to `StatusButton` and making use of them in the Status timline, so that existing buttons don't break. It also fixes a bug in the StatusButton where the hovered background color was wrongly calculated. --- ui/shared/status/StatusButton.qml | 12 +++++++----- ui/shared/status/StatusChatInput.qml | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ui/shared/status/StatusButton.qml b/ui/shared/status/StatusButton.qml index 97505b2251..1efa9f96b7 100644 --- a/ui/shared/status/StatusButton.qml +++ b/ui/shared/status/StatusButton.qml @@ -12,7 +12,9 @@ Button { property color color: type === "warn" ? Style.current.danger : Style.current.buttonForegroundColor property color bgColor: type === "warn" ? Style.current.buttonWarnBackgroundColor : Style.current.buttonBackgroundColor property color borderColor: color - property color hoveredBorderColor + property color hoveredBorderColor: color + property bool forceBgColorOnHover: false + property int borderRadius: Style.current.radius property color bgHoverColor: { if (type === "warn") { if (showBorder) { @@ -111,21 +113,21 @@ Button { } background: Rectangle { - radius: Style.current.radius + radius: borderRadius anchors.fill: parent border.width: flat || showBorder ? 1 : 0 border.color: { if (hovered) { - return !!control.hoveredBorderColor ? control.hoveredBorderColor : control.borderColor + return control.hoveredBorderColor !== control.borderColor ? control.hoveredBorderColor : control.borderColor } - if (showBorder) { + if (showBorder && enabled) { return control.borderColor } return Style.current.transparent } color: { if (flat) { - return "transparent" + return hovered && forceBgColorOnHover ? control.bgHoverColor : "transparent" } if (type === "secondary") { return hovered ? control.bgColor : "transparent" diff --git a/ui/shared/status/StatusChatInput.qml b/ui/shared/status/StatusChatInput.qml index af1ad4b9e0..1d0670d8fd 100644 --- a/ui/shared/status/StatusChatInput.qml +++ b/ui/shared/status/StatusChatInput.qml @@ -753,11 +753,14 @@ Rectangle { StatusButton { id: sendBtn icon.source: "../../app/img/send.svg" - color: Style.current.secondaryText icon.width: 16 icon.height: 18 + borderRadius: 16 text: qsTr("Send") + type: "secondary" flat: true + showBorder: true + forceBgColorOnHover: true anchors.right: parent.right anchors.rightMargin: Style.current.halfPadding anchors.bottom: parent.bottom