repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

quickshell/nuguland/NokoButton.qml

Raw
import QtQuick

Rectangle {
    id: root

    required property Theme theme
    property string label: ""
    property string kind: "ghost"
    property real buttonWidth: 0
    readonly property bool primary: kind === "primary"
    signal clicked

    width: buttonWidth > 0 ? buttonWidth : Math.max(1, parent ? (parent.width - 8) / 2 : 160)
    height: 34
    radius: 10
    color: theme ? theme.withAlpha(primary ? theme.ui.accent : theme.ui.minor, enabled ? (primary ? 0.34 : 0.11) : 0.06) : "transparent"
    border.width: 0
    border.color: "transparent"
    opacity: 1

    NuguText {
        anchors.centerIn: parent
        width: parent.width
        height: parent.height
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        theme: root.theme
        variant: "meta"
        text: root.label
        color: root.theme ? (root.enabled ? (root.primary ? root.theme.ui.accent : root.theme.content.normal) : root.theme.ui.normal) : "white"
    }

    MouseArea {
        anchors.fill: parent
        enabled: root.enabled
        hoverEnabled: true
        cursorShape: Qt.PointingHandCursor
        onClicked: root.clicked()
    }
}