logos-storage-app-skeleton/src/qml/LogosStorageButton.qml

57 lines
1.4 KiB
QML
Raw Normal View History

2026-02-17 11:29:04 +04:00
import QtQuick
import QtQuick.Controls
import Logos.Theme
Button {
id: control
padding: Theme.spacing.small
// "default" | "success"
property string variant: "default"
readonly property bool isSuccess: variant === "success"
2026-02-17 11:29:04 +04:00
contentItem: Text {
text: control.text
font.pixelSize: Theme.typography.primaryText
color: {
if (!control.enabled)
return Theme.palette.textMuted
if (control.isSuccess)
return Theme.palette.background
return Theme.palette.text
}
2026-02-17 11:29:04 +04:00
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: {
if (!control.enabled)
return Theme.palette.backgroundElevated
if (control.isSuccess)
return Theme.palette.success
2026-02-17 11:29:04 +04:00
return Theme.palette.backgroundSecondary
}
border.width: 1
border.color: {
if (!control.enabled)
return Theme.palette.border
if (control.isSuccess)
return Theme.palette.success
return Theme.palette.border
}
2026-02-17 11:29:04 +04:00
radius: Theme.spacing.tiny
Behavior on color {
ColorAnimation {
duration: 150
}
}
}
HoverHandler {
cursorShape: Qt.PointingHandCursor
}
}