RedFlag/desktop/qml/NavItem.qml
Fimeg 67e26be2d9 projection: begin the exact-path public epoch
The public tree and its history contain only the listed paths. Earlier projection history remains preserved internally.

Source-Sha: 913fde029b935671833254797f0f20f1eb9fabba

Policy-Sha: 913fde029b935671833254797f0f20f1eb9fabba

Tree-Digest: 180ae530c1058a2a5c89837bdce2d323ae83e669e38590ca72e75b8d92b7262f
2026-09-08 21:59:33 -04:00

55 lines
1.7 KiB
QML

import QtQuick
Rectangle {
id: root
required property string label
property string badge: ""
property bool selected: false
signal clicked()
// A ColumnLayout allocates rows from implicitHeight. A plain Rectangle has
// none, so an explicit height laid out as a zero-high row and every entry
// drew on top of its neighbour.
implicitWidth: 180
implicitHeight: 38
radius: Theme.radiusSm
color: selected ? Theme.selection : mouse.containsMouse ? Theme.hover : "transparent"
Rectangle {
width: 3
height: 18
radius: 2
anchors.left: parent.left
anchors.leftMargin: 2
anchors.verticalCenter: parent.verticalCenter
color: root.selected ? Theme.blue : "transparent"
}
Text {
anchors.left: parent.left
anchors.leftMargin: 16
anchors.verticalCenter: parent.verticalCenter
text: root.label
color: root.selected ? Theme.text : Theme.dim
font.pixelSize: Theme.fontBody
font.weight: root.selected ? 600 : 450
}
Rectangle {
visible: root.badge.length > 0
anchors.right: parent.right
anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
width: Math.max(20, badgeText.implicitWidth + 10)
height: 20
radius: 10
color: Theme.tint(root.selected ? Theme.red : Theme.faint, 0.22)
Text {
id: badgeText
anchors.centerIn: parent
text: root.badge
color: root.selected ? Theme.red : Theme.dim
font.pixelSize: 10
font.weight: 700
}
}
MouseArea { id: mouse; anchors.fill: parent; hoverEnabled: true; onClicked: root.clicked() }
}