mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-28 03:08:30 +00:00
Removed dot from image
This commit is contained in:
parent
d7e067616f
commit
9e9d1fc03a
@ -19,7 +19,7 @@ const Wrapper = styled.div`
|
|||||||
const ClickWrapper = styled.div`
|
const ClickWrapper = styled.div`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
padding-left: 22px;
|
padding-left: 25px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -66,6 +66,22 @@ const IconWrapper = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const ImageWrapper = styled.div`
|
||||||
|
position: relative;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Dot = styled.div`
|
||||||
|
border: 2px solid ${colors.WHITE};
|
||||||
|
border-radius: 50%;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 10;
|
||||||
|
background: ${props => props.color};
|
||||||
|
top: -4px;
|
||||||
|
right: -3px;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
`;
|
||||||
|
|
||||||
const StyledIcon = styled(Icon)`
|
const StyledIcon = styled(Icon)`
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
`;
|
`;
|
||||||
@ -81,10 +97,13 @@ const DeviceHeader = ({
|
|||||||
}) => (
|
}) => (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<ClickWrapper onClick={!disabled ? handleOpen : null}>
|
<ClickWrapper onClick={!disabled ? handleOpen : null}>
|
||||||
<TrezorImage
|
<ImageWrapper>
|
||||||
status={status}
|
<Dot color={getStatusColor(status)} />
|
||||||
model={trezorModel}
|
<TrezorImage
|
||||||
/>
|
status={status}
|
||||||
|
model={trezorModel}
|
||||||
|
/>
|
||||||
|
</ImageWrapper>
|
||||||
<LabelWrapper>
|
<LabelWrapper>
|
||||||
<Name>{label}</Name>
|
<Name>{label}</Name>
|
||||||
<Status>{getStatusName(status)}</Status>
|
<Status>{getStatusName(status)}</Status>
|
||||||
|
@ -1,36 +1,16 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import colors from 'config/colors';
|
|
||||||
import { getStatusColor } from 'utils/device';
|
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div``;
|
||||||
width: 20px;
|
|
||||||
position: relative;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Dot = styled.div`
|
|
||||||
border: 2px solid ${colors.WHITE};
|
|
||||||
border-radius: 50%;
|
|
||||||
position: absolute;
|
|
||||||
background: ${props => props.color};
|
|
||||||
top: -5px;
|
|
||||||
right: 0px;
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Img = styled.img`
|
const Img = styled.img`
|
||||||
width: ${props => (props.model === 'T' ? '17px' : '13px')};
|
width: ${props => (props.model === 'T' ? '17px' : '13px')};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TrezorImage = ({ model, status }) => (
|
const TrezorImage = ({ model }) => (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
{status && <Dot color={getStatusColor(status)} />}
|
<Img model={model} src={model === 'T' ? './images/trezor-T.png' : './images/trezor-1.png'} />
|
||||||
<Img
|
|
||||||
model={model}
|
|
||||||
src={model === 'T' ? './images/trezor-T.png' : './images/trezor-1.png'}
|
|
||||||
/>
|
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import colors from 'js/config/colors';
|
import colors from 'js/config/colors';
|
||||||
|
|
||||||
const getDeviceSelectStatus = (device) => {
|
const getStatus = (device) => {
|
||||||
let status = 'connected';
|
let status = 'connected';
|
||||||
if (!device.connected) {
|
if (!device.connected) {
|
||||||
status = 'disconnected';
|
status = 'disconnected';
|
||||||
@ -18,7 +18,6 @@ const getDeviceSelectStatus = (device) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getStatusName = (deviceStatus) => {
|
const getStatusName = (deviceStatus) => {
|
||||||
const unknownStatusName = 'Status unknown';
|
|
||||||
let statusName;
|
let statusName;
|
||||||
switch (deviceStatus) {
|
switch (deviceStatus) {
|
||||||
case 'used-in-other-window':
|
case 'used-in-other-window':
|
||||||
@ -34,9 +33,8 @@ const getStatusName = (deviceStatus) => {
|
|||||||
statusName = 'Unavailable';
|
statusName = 'Unavailable';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
statusName = unknownStatusName;
|
statusName = 'Status unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
return statusName;
|
return statusName;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,7 +43,7 @@ const isWebUSB = transport => !!((transport && transport.version.indexOf('webusb
|
|||||||
const isDisabled = (selectedDevice, devices, transport) => (devices.length < 1 && !isWebUSB(transport)) || (devices.length === 1 && !selectedDevice.features && !isWebUSB(transport));
|
const isDisabled = (selectedDevice, devices, transport) => (devices.length < 1 && !isWebUSB(transport)) || (devices.length === 1 && !selectedDevice.features && !isWebUSB(transport));
|
||||||
|
|
||||||
const getVersion = (device) => {
|
const getVersion = (device) => {
|
||||||
let version = null;
|
let version;
|
||||||
if (device.features && device.features.major_version > 1) {
|
if (device.features && device.features.major_version > 1) {
|
||||||
version = 'T';
|
version = 'T';
|
||||||
} else {
|
} else {
|
||||||
@ -55,8 +53,7 @@ const getVersion = (device) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getStatusColor = (deviceStatus) => {
|
const getStatusColor = (deviceStatus) => {
|
||||||
let color = null;
|
let color;
|
||||||
|
|
||||||
switch (deviceStatus) {
|
switch (deviceStatus) {
|
||||||
case 'used-in-other-window':
|
case 'used-in-other-window':
|
||||||
color = colors.WARNING_PRIMARY;
|
color = colors.WARNING_PRIMARY;
|
||||||
@ -71,16 +68,13 @@ const getStatusColor = (deviceStatus) => {
|
|||||||
color = colors.ERROR_PRIMARY;
|
color = colors.ERROR_PRIMARY;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
color = colors.ERROR_PRIMARY;
|
color = colors.TEXT_PRIMARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('color', color);
|
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getDeviceSelectStatus,
|
getStatus,
|
||||||
isDisabled,
|
isDisabled,
|
||||||
getStatusName,
|
getStatusName,
|
||||||
getVersion,
|
getVersion,
|
||||||
|
@ -4,7 +4,7 @@ import styled from 'styled-components';
|
|||||||
import TrezorConnect from 'trezor-connect';
|
import TrezorConnect from 'trezor-connect';
|
||||||
import type { TrezorDevice } from 'flowtype';
|
import type { TrezorDevice } from 'flowtype';
|
||||||
import DeviceHeader from 'components/DeviceHeader';
|
import DeviceHeader from 'components/DeviceHeader';
|
||||||
import { getDeviceSelectStatus, getVersion } from 'utils/device';
|
import { getStatus, getVersion } from 'utils/device';
|
||||||
|
|
||||||
// import DeviceList from './components/DeviceList';
|
// import DeviceList from './components/DeviceList';
|
||||||
import type { Props } from '../common';
|
import type { Props } from '../common';
|
||||||
@ -63,7 +63,7 @@ export const DeviceSelect = (props: Props) => {
|
|||||||
<DeviceHeader
|
<DeviceHeader
|
||||||
handleOpen={handleOpen}
|
handleOpen={handleOpen}
|
||||||
label={selected.instanceLabel}
|
label={selected.instanceLabel}
|
||||||
status={getDeviceSelectStatus(selected)}
|
status={getStatus(selected)}
|
||||||
deviceCount={deviceCount}
|
deviceCount={deviceCount}
|
||||||
isOpen={props.deviceDropdownOpened}
|
isOpen={props.deviceDropdownOpened}
|
||||||
trezorModel={getVersion(selected)}
|
trezorModel={getVersion(selected)}
|
||||||
|
Loading…
Reference in New Issue
Block a user