feat(StatusRoundButton): Added `Tertiary` type

- Transparent background but when hovered, like Primary type in idle state.

- Updated sandbox with the new type.
This commit is contained in:
Noelia 2022-06-23 09:42:23 +02:00 committed by Noelia
parent 604bb7a74c
commit b064f9ebd8
2 changed files with 46 additions and 3 deletions

View File

@ -174,6 +174,25 @@ Column {
loading: true
}
// transparent
StatusRoundButton {
type: StatusRoundButton.Type.Tertiary
icon.name: "info"
}
StatusRoundButton {
type: StatusRoundButton.Type.Tertiary
icon.name: "info"
enabled: false
}
StatusRoundButton {
type: StatusRoundButton.Type.Tertiary
icon.name: "info"
loading: true
}
// Rounded blue
StatusFlatRoundButton {

View File

@ -12,14 +12,27 @@ Rectangle {
height: 23
rotation: 0
property color hoverColor: {
switch(statusRoundButton.type) {
case StatusRoundButton.Type.Primary:
return Theme.palette.primaryColor1;
case StatusRoundButton.Type.Secondary:
return Theme.palette.indirectColor1;
case StatusRoundButton.Type.Tertiary:
return Theme.palette.primaryColor1;
}
}
color: {
switch(statusRoundButton.type) {
case StatusRoundButton.Type.Primary:
return Theme.palette.primaryColor1;
case StatusRoundButton.Type.Secondary:
return Theme.palette.indirectColor1;
case StatusRoundButton.Type.Tertiary:
return Theme.palette.baseColor1;
}
}
}
disabledColor: {
switch(statusRoundButton.type) {
@ -27,6 +40,8 @@ Rectangle {
return Theme.palette.baseColor1;
case StatusRoundButton.Type.Secondary:
return Theme.palette.indirectColor1;
case StatusRoundButton.Type.Tertiary:
return Theme.palette.baseColor1;
}
}
}
@ -46,7 +61,8 @@ Rectangle {
enum Type {
Primary,
Secondary
Secondary,
Tertiary
}
/// Implementation
@ -59,6 +75,8 @@ Rectangle {
return Theme.palette.primaryColor3;
case StatusRoundButton.Type.Secondary:
return Theme.palette.primaryColor1;
case StatusRoundButton.Type.Tertiary:
return "transparent";
}
}
@ -68,6 +86,8 @@ Rectangle {
return Theme.palette.primaryColor2;
case StatusRoundButton.Type.Secondary:
return Theme.palette.miscColor1;
case StatusRoundButton.Type.Tertiary:
return Theme.palette.primaryColor3;
}
}
@ -77,13 +97,17 @@ Rectangle {
return Theme.palette.baseColor2;
case StatusRoundButton.Type.Secondary:
return Theme.palette.baseColor1;
case StatusRoundButton.Type.Tertiary:
return "transparent";
}
}
}
QtObject {
id: d
readonly property color iconColor: statusRoundButton.enabled ? statusRoundButton.icon.color : statusRoundButton.icon.disabledColor
readonly property color iconColor: !statusRoundButton.enabled ? statusRoundButton.icon.disabledColor :
(statusRoundButton.enabled && statusRoundButton.hovered) ? statusRoundButton.icon.hoverColor :
statusRoundButton.icon.color
}
implicitWidth: 44