Skip to content

Commit 0cee6c3

Browse files
committed
qml: fix NavButton padding
1 parent ecf7145 commit 0cee6c3

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

src/qml/controls/NavButton.qml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ AbstractButton {
1515
property Rectangle iconBackground: null
1616
property color iconColor: Theme.color.neutral9
1717

18-
padding: 0
18+
topPadding: text_background.active ? 7 : 14
19+
bottomPadding: text_background.active ? 7 : 14
20+
rightPadding: text_background.active ? 22 : 14
21+
leftPadding: text_background.active ? 2 : 14
1922
background: Rectangle {
2023
id: bg
2124
height: root.height
@@ -43,7 +46,6 @@ AbstractButton {
4346
}
4447
}
4548
contentItem: RowLayout {
46-
anchors.fill: parent
4749
spacing: 0
4850
Loader {
4951
id: button_background
@@ -63,22 +65,25 @@ AbstractButton {
6365
}
6466
}
6567
Loader {
66-
active: root.text.length > 0
67-
visible: active
68-
sourceComponent: AbstractButton {
69-
id: container
70-
padding: 0
71-
font.family: "Inter"
72-
font.styleName: "Semi Bold"
73-
font.pixelSize: root.textSize
74-
background: null
75-
contentItem: Text {
76-
anchors.verticalCenter: parent.verticalCenter
77-
font: container.font
78-
color: Theme.color.neutral9
79-
text: root.text
80-
}
81-
}
68+
id: text_background
69+
active: root.text.length > 0
70+
visible: active
71+
sourceComponent: AbstractButton {
72+
id: container
73+
topPadding: button_background.active ? 0 : 4
74+
bottomPadding: button_background.active ? 0 : 4
75+
rightPadding: 0
76+
leftPadding: button_background.active ? 0 : 20
77+
font.family: "Inter"
78+
font.styleName: "Semi Bold"
79+
font.pixelSize: root.textSize
80+
contentItem: Text {
81+
anchors.verticalCenter: parent.verticalCenter
82+
font: container.font
83+
color: Theme.color.neutral9
84+
text: root.text
85+
}
86+
}
8287
}
8388
}
8489
MouseArea {

0 commit comments

Comments
 (0)