From 390d18725ac6e63c1cff92379ea6718fa6754238 Mon Sep 17 00:00:00 2001 From: saml33 Date: Thu, 23 Jun 2022 14:10:37 +1000 Subject: [PATCH] anchor account summary to bottom of scroll window --- components/AccountOverviewPopover.tsx | 10 + components/SideNav.tsx | 283 +++++++++++++------------- styles/index.css | 25 --- 3 files changed, 156 insertions(+), 162 deletions(-) diff --git a/components/AccountOverviewPopover.tsx b/components/AccountOverviewPopover.tsx index e42d2832..14a2f81a 100644 --- a/components/AccountOverviewPopover.tsx +++ b/components/AccountOverviewPopover.tsx @@ -45,6 +45,15 @@ const AccountOverviewPopover = ({ collapsed }: { collapsed: boolean }) => { ) : undefined + const toggleAccountSummary = (open) => { + const id = document.getElementById('sidebar-content') + if (open) { + id?.style.setProperty('height', 'calc(100vh - 325px)', '') + } else { + id?.style.setProperty('height', 'calc(100vh - 125px)', '') + } + } + return ( <> {mangoAccount ? ( @@ -62,6 +71,7 @@ const AccountOverviewPopover = ({ collapsed }: { collapsed: boolean }) => { } icon={} + onOpenChange={(open) => toggleAccountSummary(open)} >
{collapsed ? ( diff --git a/components/SideNav.tsx b/components/SideNav.tsx index 353ba55c..862c400f 100644 --- a/components/SideNav.tsx +++ b/components/SideNav.tsx @@ -60,147 +60,156 @@ const SideNav = ({ collapsed, setCollapsed }) => { /> - - -
-
- next - {!collapsed ? ( - - Mango - - ) : null} -
-
- -
- - - } - > +
+
+ - {t('trade')} - - - } - > - - {t('account')} - - - } - > - - {t('markets')} - - - } - > - - {t('borrow')} - - - } - > - - {t('swap')} - - - } - > - - {t('stats')} - - - } - > - - {t('leaderboard')} - - - } - > - } - > - - {t('referrals')} - - - } - > - - {t('calculator')} - - - } - > - - {t('fees')} - - - } - suffix={} - > - - {t('learn')} - - - } - suffix={} - > - + next + {!collapsed ? ( + + Mango + + ) : null} +
+
+ + + + + } > - {t('governance')} - - - - - + + {t('trade')} + +
+ } + > + + {t('account')} + + + } + > + + {t('markets')} + + + } + > + + {t('borrow')} + + + } + > + + {t('swap')} + + + } + > + + {t('stats')} + + + } + > + + {t('leaderboard')} + + + } + > + } + > + + {t('referrals')} + + + } + > + + {t('calculator')} + + + } + > + + {t('fees')} + + + } + suffix={} + > + + {t('learn')} + + + } + suffix={} + > + + {t('governance')} + + + +
+
- {mangoAccount ? ( - - - - ) : null} + {mangoAccount ? ( + + + + ) : null} +
+ ) diff --git a/styles/index.css b/styles/index.css index 66d84190..4295e2a4 100644 --- a/styles/index.css +++ b/styles/index.css @@ -648,31 +648,6 @@ body::-webkit-scrollbar-corner { color: inherit; } -.pro-sidebar > .pro-sidebar-inner > .pro-sidebar-layout::-webkit-scrollbar { - width: 8px; - height: 8px; -} - -.pro-sidebar - > .pro-sidebar-inner - > .pro-sidebar-layout::-webkit-scrollbar-thumb { - @apply rounded bg-th-bkg-3; - border: 2px solid transparent; - background-clip: padding-box; -} - -.pro-sidebar - > .pro-sidebar-inner - > .pro-sidebar-layout::-webkit-scrollbar-track { - background: transparent; -} - -.pro-sidebar - > .pro-sidebar-inner - > .pro-sidebar-layout::-webkit-scrollbar-thumb:window-inactive { - @apply bg-th-bkg-3; -} - @keyframes sideways-bounce { 0%, 100% {