Commit fb05439d authored by eddie's avatar eddie Committed by GitHub

fix: mini portfolio layout fixes (#6260)

* fix: mini portfolio layout fixes

* feat: refactor MP drawer CSS
parent fb7eade7
...@@ -36,7 +36,7 @@ import MiniPortfolio from './MiniPortfolio' ...@@ -36,7 +36,7 @@ import MiniPortfolio from './MiniPortfolio'
import { portfolioFadeInAnimation } from './MiniPortfolio/PortfolioRow' import { portfolioFadeInAnimation } from './MiniPortfolio/PortfolioRow'
const AuthenticatedHeaderWrapper = styled.div` const AuthenticatedHeaderWrapper = styled.div`
padding: 14px 12px 16px 16px; padding: 20px 16px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 1; flex: 1;
......
...@@ -76,16 +76,22 @@ const WalletDropdownScrollWrapper = styled.div` ...@@ -76,16 +76,22 @@ const WalletDropdownScrollWrapper = styled.div`
border-radius: 12px; border-radius: 12px;
` `
const WalletDropdownWrapper = styled.div<{ open: boolean }>` const Wrapper = styled.div`
display: flex;
flex-direction: row;
height: calc(100% - 2 * ${DRAWER_MARGIN});
overflow: hidden;
position: fixed; position: fixed;
right: ${DRAWER_MARGIN};
top: ${DRAWER_MARGIN}; top: ${DRAWER_MARGIN};
right: ${({ open }) => (open ? DRAWER_MARGIN : '-' + DRAWER_WIDTH)};
z-index: ${Z_INDEX.fixed}; z-index: ${Z_INDEX.fixed};
`
const WalletDropdownWrapper = styled.div<{ open: boolean }>`
margin-right: ${({ open }) => (open ? 0 : '-' + DRAWER_WIDTH)};
height: 100%;
overflow: hidden; overflow: hidden;
height: calc(100% - 2 * ${DRAWER_MARGIN});
@media only screen and (max-width: ${({ theme }) => `${theme.breakpoint.sm}px`}) { @media only screen and (max-width: ${({ theme }) => `${theme.breakpoint.sm}px`}) {
z-index: ${Z_INDEX.modal}; z-index: ${Z_INDEX.modal};
top: unset; top: unset;
...@@ -101,7 +107,7 @@ const WalletDropdownWrapper = styled.div<{ open: boolean }>` ...@@ -101,7 +107,7 @@ const WalletDropdownWrapper = styled.div<{ open: boolean }>`
} }
@media screen and (min-width: 1440px) { @media screen and (min-width: 1440px) {
right: ${({ open }) => (open ? DRAWER_MARGIN : '-' + DRAWER_WIDTH_XL)}; margin-right: ${({ open }) => (open ? 0 : '-' + DRAWER_WIDTH_XL)};
width: ${DRAWER_WIDTH_XL}; width: ${DRAWER_WIDTH_XL};
} }
...@@ -112,7 +118,7 @@ const WalletDropdownWrapper = styled.div<{ open: boolean }>` ...@@ -112,7 +118,7 @@ const WalletDropdownWrapper = styled.div<{ open: boolean }>`
border: ${({ theme }) => `1px solid ${theme.backgroundOutline}`}; border: ${({ theme }) => `1px solid ${theme.backgroundOutline}`};
box-shadow: ${({ theme }) => theme.deepShadow}; box-shadow: ${({ theme }) => theme.deepShadow};
transition: right ${({ theme }) => theme.transition.duration.medium}, transition: margin-right ${({ theme }) => theme.transition.duration.medium},
bottom ${({ theme }) => theme.transition.duration.medium}; bottom ${({ theme }) => theme.transition.duration.medium};
` `
...@@ -123,11 +129,7 @@ const CloseIcon = styled(ChevronsRight).attrs({ size: 24 })` ...@@ -123,11 +129,7 @@ const CloseIcon = styled(ChevronsRight).attrs({ size: 24 })`
const CloseDrawer = styled.div` const CloseDrawer = styled.div`
${ClickableStyle} ${ClickableStyle}
cursor: pointer; cursor: pointer;
height: calc(100% - 2 * ${DRAWER_MARGIN}); height: 100%;
position: fixed;
right: calc(${DRAWER_MARGIN} + ${DRAWER_WIDTH} - ${DRAWER_OFFSET});
top: 4px;
z-index: ${Z_INDEX.dropdown};
// When the drawer is not hovered, the icon should be 18px from the edge of the sidebar. // When the drawer is not hovered, the icon should be 18px from the edge of the sidebar.
padding: 24px calc(18px + ${DRAWER_OFFSET}) 24px 14px; padding: 24px calc(18px + ${DRAWER_OFFSET}) 24px 14px;
border-radius: 20px 0 0 20px; border-radius: 20px 0 0 20px;
...@@ -140,9 +142,6 @@ const CloseDrawer = styled.div` ...@@ -140,9 +142,6 @@ const CloseDrawer = styled.div`
@media only screen and (max-width: ${({ theme }) => `${theme.breakpoint.sm}px`}) { @media only screen and (max-width: ${({ theme }) => `${theme.breakpoint.sm}px`}) {
display: none; display: none;
} }
@media screen and (min-width: 1440px) {
right: calc(${DRAWER_MARGIN} + ${DRAWER_WIDTH_XL} - ${DRAWER_OFFSET});
}
` `
function WalletDropdown() { function WalletDropdown() {
...@@ -187,7 +186,7 @@ function WalletDropdown() { ...@@ -187,7 +186,7 @@ function WalletDropdown() {
}, [walletDrawerOpen, toggleWalletDrawer]) }, [walletDrawerOpen, toggleWalletDrawer])
return ( return (
<> <Wrapper>
{walletDrawerOpen && ( {walletDrawerOpen && (
<TraceEvent <TraceEvent
events={[BrowserEvent.onClick]} events={[BrowserEvent.onClick]}
...@@ -206,7 +205,7 @@ function WalletDropdown() { ...@@ -206,7 +205,7 @@ function WalletDropdown() {
<DefaultMenu /> <DefaultMenu />
</WalletDropdownScrollWrapper> </WalletDropdownScrollWrapper>
</WalletDropdownWrapper> </WalletDropdownWrapper>
</> </Wrapper>
) )
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment