feat(StatusFlatRoundButton): introduce `highlighted` color for secondary type

Closes #245
This commit is contained in:
Pascal Precht 2021-07-13 17:05:31 +02:00 committed by Michał Cieślak
parent 4fcdbab22e
commit 17d5978fe4
2 changed files with 16 additions and 2 deletions

View File

@ -450,6 +450,9 @@ Rectangle {
chatInfoButton.subTitle: "Community Chat" chatInfoButton.subTitle: "Community Chat"
chatInfoButton.icon.color: Theme.palette.miscColor6 chatInfoButton.icon.color: Theme.palette.miscColor6
chatInfoButton.type: StatusChatInfoButton.Type.CommunityChat chatInfoButton.type: StatusChatInfoButton.Type.CommunityChat
searchButton.onClicked: searchButton.highlighted = !searchButton.highlighted
membersButton.onClicked: membersButton.highlighted = !membersButton.highlighted
} }
} }
} }

View File

@ -78,6 +78,15 @@ Rectangle {
return "transparent"; return "transparent";
} }
} }
property color highlightedColor: {
switch(statusFlatRoundButton.type) {
case StatusFlatRoundButton.Type.Primary:
return Theme.palette.primaryColor3;
case StatusFlatRoundButton.Type.Secondary:
return Theme.palette.baseColor4;
}
}
} }
implicitWidth: 44 implicitWidth: 44
@ -86,8 +95,10 @@ Rectangle {
color: { color: {
if (statusFlatRoundButton.enabled) { if (statusFlatRoundButton.enabled) {
return sensor.containsMouse || highlighted ? backgroundSettings.hoverColor if (sensor.containsMouse) {
: backgroundSettings.color return backgroundSettings.hoverColor
}
return highlighted ? backgroundSettings.highlightedColor : backgroundSettings.color
} else { } else {
return backgroundSettings.disabledColor return backgroundSettings.disabledColor
} }