aboutsummaryrefslogtreecommitdiff
path: root/modules/system/quickshell/ControlTile.qml
blob: d944e89acf6db2ee8534b03bcdadf0bb62a50b22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import QtQuick
import QtQuick.Layouts
import Quickshell

Item {
    id: root
    property string icon: ""
    property string label: ""
    property bool active: false
    property var clickHandler: null

    Layout.fillWidth: true
    Layout.preferredHeight: 64

    Squircle {
        anchors.fill: parent
        cornerRadius: 16
        fillColor: root.active ? Theme.accent : Theme.surface

        MouseArea {
            anchors.fill: parent
            hoverEnabled: true
            onClicked: {
                if (root.clickHandler)
                    root.clickHandler();
            }
        }

        RowLayout {
            anchors.fill: parent
            anchors.margins: 12
            spacing: 12

            IconCircle {
                source: root.icon
                active: root.active
            }

            Text {
                text: root.label
                color: root.active ? Theme.bg : Theme.text
                font.family: Theme.mainFont
                font.pixelSize: 11
                font.weight: Font.Medium
                elide: Text.ElideRight
                Layout.maximumWidth: 80
                visible: root.label !== ""
            }
        }
    }
}