From 74cf0f26c4b7e26a00bddf3ce86d196b744dd47f Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 13 Nov 2017 22:25:15 -0800 Subject: [PATCH] Render more space efficient user nav when viewport is insufficient --- ui/src/side_nav/components/UserNavBlock.js | 179 ++++++++++++++------- ui/src/style/layout/sidebar.scss | 10 ++ 2 files changed, 134 insertions(+), 55 deletions(-) diff --git a/ui/src/side_nav/components/UserNavBlock.js b/ui/src/side_nav/components/UserNavBlock.js index 135c6f3fa0..b451067134 100644 --- a/ui/src/side_nav/components/UserNavBlock.js +++ b/ui/src/side_nav/components/UserNavBlock.js @@ -27,6 +27,8 @@ class UserNavBlock extends Component { const isSuperAdmin = role === SUPERADMIN_ROLE + const isSmallViewport = window.visualViewport.height < 850 + return (
@@ -35,62 +37,129 @@ class UserNavBlock extends Component { ? : null}
-
-
- {me.name} -
-
Account
- {isSuperAdmin - ?
-
- You are a SuperAdmin -
+ {isSmallViewport + ?
+ {customLinks + ?
Custom Links
+ : null} + {customLinks + ? customLinks.map((link, i) => + + {link.name} + + ) + : null} +
Switch Organizations
+ + {roles.map((r, i) => { + const isLinkCurrentOrg = + currentOrganization.id === r.organization + return ( + + { + organizations.find(o => o.id === r.organization).name + }{' '} + ({r.name}) + + ) + })} + +
Account
+ + Logout + + {isSuperAdmin + ?
+
+ You are a SuperAdmin +
+
+ : null} +
+ {me.name}
- : null} - - Logout - -
Switch Organizations
- - {roles.map((r, i) => { - const isLinkCurrentOrg = currentOrganization.id === r.organization - return ( - - {organizations.find(o => o.id === r.organization).name}{' '} - ({r.name}) - - ) - })} - - {customLinks - ?
Custom Links
- : null} - {customLinks - ? customLinks.map((link, i) => - - {link.name} - - ) - : null} -
-
+
+
+ :
+
+ {me.name} +
+
Account
+ {isSuperAdmin + ?
+
+ You are a SuperAdmin +
+
+ : null} + + Logout + +
Switch Organizations
+ + {roles.map((r, i) => { + const isLinkCurrentOrg = + currentOrganization.id === r.organization + return ( + + { + organizations.find(o => o.id === r.organization).name + }{' '} + ({r.name}) + + ) + })} + + {customLinks + ?
Custom Links
+ : null} + {customLinks + ? customLinks.map((link, i) => + + {link.name} + + ) + : null} +
+
}
) } diff --git a/ui/src/style/layout/sidebar.scss b/ui/src/style/layout/sidebar.scss index d83c9e6618..0b410a3cb9 100644 --- a/ui/src/style/layout/sidebar.scss +++ b/ui/src/style/layout/sidebar.scss @@ -140,6 +140,11 @@ $sidebar-menu--gutter: 18px; transition: opacity 0.25s ease; display: none; flex-direction: column; + + &.sidebar-menu--inverse { + top: initial; + bottom: 0; + } } .sidebar-menu--heading, .sidebar-menu--item { @@ -229,6 +234,11 @@ $sidebar-menu--gutter: 18px; height: 2px; @include gradient-h($c-laser,$c-potassium); } + + &:first-child:after { + display: none; + border-top-right-radius: $radius; + } } // SuperAdminIndicator