diff options
| author | Nippy <nippy@rp1.hu> | 2026-05-08 19:50:49 +0200 |
|---|---|---|
| committer | Nippy <nippy@rp1.hu> | 2026-05-08 19:50:49 +0200 |
| commit | 3462bcc46ecf74f576ea4397f16492c16bd75b10 (patch) | |
| tree | c5ab7aef4498647e057bda8d49c11e5f9dda74c9 /raveos-hyprland-theme/theme-data/dms/Widgets/DankButton.qml | |
| parent | 56616f693b4f263cbf0d47da43b67424efa6022d (diff) | |
| download | RaveOS-PKGBUILD-3462bcc46ecf74f576ea4397f16492c16bd75b10.tar.gz RaveOS-PKGBUILD-3462bcc46ecf74f576ea4397f16492c16bd75b10.zip | |
raveos update
Diffstat (limited to 'raveos-hyprland-theme/theme-data/dms/Widgets/DankButton.qml')
| -rw-r--r-- | raveos-hyprland-theme/theme-data/dms/Widgets/DankButton.qml | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/raveos-hyprland-theme/theme-data/dms/Widgets/DankButton.qml b/raveos-hyprland-theme/theme-data/dms/Widgets/DankButton.qml new file mode 100644 index 0000000..ea8a202 --- /dev/null +++ b/raveos-hyprland-theme/theme-data/dms/Widgets/DankButton.qml @@ -0,0 +1,99 @@ +import QtQuick +import qs.Common +import qs.Widgets + +Rectangle { + id: root + + property string text: "" + property string iconName: "" + property int iconSize: Theme.iconSizeSmall + property bool enabled: true + property bool hovered: mouseArea.containsMouse + property bool pressed: mouseArea.pressed + property color backgroundColor: Theme.buttonBg + property color textColor: Theme.buttonText + property int buttonHeight: 40 + property int horizontalPadding: Theme.spacingL + property bool enableScaleAnimation: false + property bool enableRipple: typeof SettingsData !== "undefined" ? (SettingsData.enableRippleEffects ?? true) : true + + signal clicked + + width: Math.max(contentRow.implicitWidth + horizontalPadding * 2, 64) + height: buttonHeight + radius: Theme.cornerRadius + color: backgroundColor + opacity: enabled ? 1 : 0.4 + scale: (enableScaleAnimation && pressed) ? 0.98 : 1.0 + + Behavior on scale { + enabled: enableScaleAnimation && Theme.currentAnimationSpeed !== SettingsData.AnimationSpeed.None + DankAnim { + duration: 100 + easing.bezierCurve: Theme.expressiveCurves.standard + } + } + + Rectangle { + id: stateLayer + anchors.fill: parent + radius: parent.radius + color: { + if (pressed) + return Theme.withAlpha(root.textColor, 0.20); + if (hovered) + return Theme.withAlpha(root.textColor, 0.12); + return "transparent"; + } + + Behavior on color { + ColorAnimation { + duration: Theme.shorterDuration + easing.type: Theme.standardEasing + } + } + } + + DankRipple { + id: rippleLayer + rippleColor: root.textColor + cornerRadius: root.radius + enableRipple: root.enableRipple + } + + Row { + id: contentRow + anchors.centerIn: parent + spacing: Theme.spacingS + + DankIcon { + name: root.iconName + size: root.iconSize + color: root.textColor + visible: root.iconName !== "" + anchors.verticalCenter: parent.verticalCenter + } + + StyledText { + text: root.text + font.pixelSize: Theme.fontSizeMedium + font.weight: Font.Medium + color: root.textColor + anchors.verticalCenter: parent.verticalCenter + } + } + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor + enabled: root.enabled + onPressed: mouse => { + if (root.enableRipple) + rippleLayer.trigger(mouse.x, mouse.y); + } + onClicked: root.clicked() + } +} |