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.
This commit is contained in:
Pascal Precht 2021-01-29 11:00:37 +01:00
parent 59b1a70f7e
commit ea2238f998
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 11 additions and 6 deletions

View File

@ -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"

View File

@ -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