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

This commit is contained in:
RichΛrd 2021-08-06 12:47:57 -04:00 committed by GitHub
parent aab59763e5
commit 2e1359c9e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 2 deletions

View File

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