added focus style to coinmenu items for easy tabbing

pull/545/head
slowbackspace 5 years ago
parent 5c00072d2f
commit bbc1b4ebaa

@ -5,7 +5,6 @@ import coins from 'constants/coins';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { Link, colors, icons as ICONS } from 'trezor-ui-components'; import { Link, colors, icons as ICONS } from 'trezor-ui-components';
import { NavLink } from 'react-router-dom';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import Divider from '../Divider'; import Divider from '../Divider';
import RowCoin from '../RowCoin'; import RowCoin from '../RowCoin';
@ -16,14 +15,15 @@ import type { Props } from '../common';
const Wrapper = styled.div``; const Wrapper = styled.div``;
const ExternalWallet = styled.div`
cursor: pointer;
`;
const StyledLink = styled(Link)` const StyledLink = styled(Link)`
display: block;
&:hover { &:hover {
text-decoration: none; text-decoration: none;
} }
&:focus {
background: ${colors.GRAY_LIGHT};
}
`; `;
const Empty = styled.span` const Empty = styled.span`
@ -78,12 +78,13 @@ class CoinMenu extends PureComponent<Props> {
if (coin.external) if (coin.external)
return ( return (
<ExternalWallet <StyledLink
tabIndex="0"
key={coin.id} key={coin.id}
onClick={() => this.props.gotoExternalWallet(coin.id, coin.url)} onClick={() => this.props.gotoExternalWallet(coin.id, coin.url)}
> >
{row} {row}
</ExternalWallet> </StyledLink>
); );
return ( return (
<StyledLink isGray key={coin.id} href={coin.url} target="_top"> <StyledLink isGray key={coin.id} href={coin.url} target="_top">
@ -142,7 +143,7 @@ class CoinMenu extends PureComponent<Props> {
.filter(item => !hiddenCoins.includes(item.shortcut)) // hide coins by user settings .filter(item => !hiddenCoins.includes(item.shortcut)) // hide coins by user settings
.sort((a, b) => a.order - b.order) .sort((a, b) => a.order - b.order)
.map(item => ( .map(item => (
<NavLink <StyledLink
key={item.shortcut} key={item.shortcut}
to={`${this.getBaseUrl()}/network/${item.shortcut}/account/0`} to={`${this.getBaseUrl()}/network/${item.shortcut}/account/0`}
> >
@ -152,7 +153,7 @@ class CoinMenu extends PureComponent<Props> {
shortcut: item.shortcut, shortcut: item.shortcut,
}} }}
/> />
</NavLink> </StyledLink>
))} ))}
{!this.isBottomMenuEmpty() && ( {!this.isBottomMenuEmpty() && (
<Divider <Divider

@ -44,8 +44,8 @@ const IconWrapper = styled.div`
margin-right: 10px; margin-right: 10px;
`; `;
const RowCoin = ({ network, iconLeft, iconRight }) => ( const RowCoin = ({ network, iconLeft, iconRight, ...rest }) => (
<RowCoinWrapper> <RowCoinWrapper {...rest}>
<Row> <Row>
<Left> <Left>
{iconLeft && ( {iconLeft && (

Loading…
Cancel
Save