1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-16 05:19:12 +00:00

Merge pull request #374 from trezor/fix/top-menu-indicator

Fix/top menu indicator
This commit is contained in:
Vladimir Volek 2019-02-19 17:55:57 +01:00 committed by GitHub
commit 3829f6e67f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,9 @@ type Props = {
router: $ElementType<State, 'router'>,
selectedAccount: $ElementType<State, 'selectedAccount'>,
};
type LocalState = {
wrapper: ?HTMLElement,
};
const Wrapper = styled.div`
position: relative;
@ -66,9 +69,18 @@ const StyledNavLink = styled(NavLink)`
}
`;
class TopNavigationAccount extends React.PureComponent<Props> {
class TopNavigationAccount extends React.PureComponent<Props, LocalState> {
constructor(props) {
super(props);
this.state = {
wrapper: null,
};
}
wrapperRefCallback = (element: ?HTMLElement) => {
this.wrapper = element;
this.setState({
wrapper: element,
});
}
wrapper: ?HTMLElement;
@ -89,7 +101,7 @@ class TopNavigationAccount extends React.PureComponent<Props> {
{network.type === 'ethereum'
&& <StyledNavLink to={`${basePath}/signverify`}>Sign &amp; Verify</StyledNavLink>
}
<Indicator pathname={pathname} wrapper={() => this.wrapper} />
<Indicator pathname={pathname} wrapper={() => this.state.wrapper} />
</Wrapper>
);
}