fix(StatusAppNavBar): add profile button (#311)

This commit is contained in:
RichΛrd 2021-08-06 12:47:57 -04:00 committed by Michał Cieślak
parent 5bfc75f50d
commit b891aa47cc
1 changed files with 22 additions and 2 deletions

View File

@ -10,6 +10,8 @@ Rectangle {
id: statusAppNavBar
property StatusNavBarTabButton navBarChatButton
property StatusNavBarTabButton navBarProfileButton
property list<StatusNavBarTabButton> navBarTabButtons
property alias navBarCommunityTabButtons: navBarCommunityTabButtons
@ -34,6 +36,12 @@ Rectangle {
}
}
onNavBarProfileButtonChanged: {
if (!!navBarProfileButton) {
navBarProfileButton.parent = navBarProfileButtonSlot
}
}
onNavBarTabButtonsChanged: {
if (navBarTabButtons.length) {
for (let idx in navBarTabButtons) {
@ -75,7 +83,9 @@ Rectangle {
if (navBarContentHeight > statusAppNavBar.height) {
height = statusAppNavBar.height -
statusAppNavBar.navBarContentHeightWithoutCommunityButtons -
(!!navBarTabButtonsSlot.anchors.bottom ? navBarTabButtonsSlot.anchors.bottomMargin : navBarTabButtonsSlot.anchors.topMargin)
(!!navBarTabButtonsSlot.anchors.bottom ? navBarTabButtonsSlot.anchors.bottomMargin : navBarTabButtonsSlot.anchors.topMargin) -
navBarProfileButtonSlot.height -
navBarProfileButtonSlot.anchors.bottomMargin
bottomPadding = 16
topPadding = 16
} else {
@ -122,7 +132,7 @@ Rectangle {
if (navBarContentHeight > statusAppNavBar.height) {
anchors.top = undefined
anchors.topMargin = 0
anchors.bottom = statusAppNavBar.bottom
anchors.bottom = navBarProfileButtonSlot.top
anchors.bottomMargin = 32
} else {
anchors.bottom = undefined
@ -132,5 +142,15 @@ Rectangle {
}
}
}
Item {
id: navBarProfileButtonSlot
anchors.horizontalCenter: parent.horizontalCenter
height: visible ? statusAppNavBar.navBarProfileButton.height : 0
width: visible ? statusAppNavBar.navBarProfileButton.width : 0
visible: !!statusAppNavBar.navBarProfileButton
anchors.bottom: parent.bottom
anchors.bottomMargin: visible ? 32 : 0
}
}