diff --git a/src/views/Wallet/components/LeftNavigation/components/DeviceMenu/index.js b/src/views/Wallet/components/LeftNavigation/components/DeviceMenu/index.js index 46eedbfc..0d235654 100644 --- a/src/views/Wallet/components/LeftNavigation/components/DeviceMenu/index.js +++ b/src/views/Wallet/components/LeftNavigation/components/DeviceMenu/index.js @@ -6,7 +6,7 @@ import { FormattedMessage } from 'react-intl'; import { Button, icons, colors as COLORS } from 'trezor-ui-components'; import { FONT_SIZE, FONT_WEIGHT } from 'config/variables'; -import { SLIDE_DOWN } from 'config/animations'; +import { SLIDE_DOWN, FADE_IN } from 'config/animations'; import * as deviceUtils from 'utils/device'; import l10nCommonMessages from 'views/common.messages'; @@ -28,6 +28,14 @@ const Wrapper = styled.div` animation: ${SLIDE_DOWN} 0.25s cubic-bezier(0.17, 0.04, 0.03, 0.94) forwards; `; +const Overlay = styled.div` + position: absolute; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.1); + animation: ${FADE_IN} 0.25s; +`; + const ButtonWrapper = styled.div` margin: 10px 0; padding: 0 24px; @@ -114,32 +122,39 @@ class DeviceMenu extends PureComponent { myRef: { current: ?HTMLDivElement }; render() { - const { devices, onSelectDevice, forgetDevice } = this.props; + const { devices, onSelectDevice, forgetDevice, toggleDeviceDropdown } = this.props; const { transport } = this.props.connect; - const { selectedDevice } = this.props.wallet; + const { selectedDevice, dropdownOpened } = this.props.wallet; return ( - - {this.showMenuItems() && } - {this.showDivider() && } - + + {this.showMenuItems() && } + {this.showDivider() && } + + {deviceUtils.isWebUSB(transport) && ( + + + + + + )} + + { + toggleDeviceDropdown(!dropdownOpened); + }} /> - {deviceUtils.isWebUSB(transport) && ( - - - - - - )} - + ); } } diff --git a/src/views/Wallet/components/LeftNavigation/components/Sidebar/index.js b/src/views/Wallet/components/LeftNavigation/components/Sidebar/index.js index 1dd7e0e4..3f0b2310 100644 --- a/src/views/Wallet/components/LeftNavigation/components/Sidebar/index.js +++ b/src/views/Wallet/components/LeftNavigation/components/Sidebar/index.js @@ -9,6 +9,7 @@ import { SLIDE_RIGHT, SLIDE_LEFT } from 'config/animations'; type Props = { children?: React.Node, isOpen: ?boolean, + deviceMenuOpened: boolean, }; type State = { @@ -18,7 +19,7 @@ type State = { const AbsoluteWrapper = styled.aside` width: 320px; position: relative; - overflow-y: auto; + overflow-y: ${props => (props.deviceMenuOpened ? 'hidden' : 'auto')}; background: ${colors.MAIN}; border-top-left-radius: 4px; @@ -28,7 +29,6 @@ const AbsoluteWrapper = styled.aside` @media screen and (max-width: ${SCREEN_SIZE.SM}) { position: absolute; - height: calc(100vh - 52px); z-index: 200; top: 52px; /* Prevents firing SLIDE_LEFT anim on page load. */ @@ -47,12 +47,19 @@ const SidebarWrapper = styled.div` height: 100%; display: flex; flex-direction: column; + + @media screen and (max-width: ${SCREEN_SIZE.SM}) { + height: calc(100vh - 52px); + } `; export default class Sidebar extends React.PureComponent { render() { return ( - + {this.props.children} ); diff --git a/src/views/Wallet/components/LeftNavigation/index.js b/src/views/Wallet/components/LeftNavigation/index.js index 63dd38e9..004cf8ce 100644 --- a/src/views/Wallet/components/LeftNavigation/index.js +++ b/src/views/Wallet/components/LeftNavigation/index.js @@ -9,8 +9,8 @@ import { TransitionGroup, CSSTransition } from 'react-transition-group'; import styled from 'styled-components'; import DeviceHeader from 'components/DeviceHeader'; import Backdrop from 'components/Backdrop'; -// import Link from 'components/Link'; import * as deviceUtils from 'utils/device'; +// import Link from 'components/Link'; import { FormattedMessage } from 'react-intl'; // import { getPattern } from 'support/routes'; @@ -58,6 +58,7 @@ const TransitionContentWrapper = styled.div` const Footer = styled.div.attrs(props => ({ style: { position: props.position }, }))` + flex: 0 0 auto; width: 320px; bottom: 0; background: ${colors.MAIN}; @@ -277,7 +278,10 @@ class LeftNavigation extends React.PureComponent { onClick={props.toggleSidebar} animated /> - +