meriadec
7 years ago
7 changed files with 149 additions and 103 deletions
@ -0,0 +1,37 @@ |
|||||
|
// @flow
|
||||
|
|
||||
|
import React, { PureComponent } from 'react' |
||||
|
import { getCryptoCurrencyIcon } from '@ledgerhq/live-common/lib/react' |
||||
|
|
||||
|
import type { Account } from '@ledgerhq/live-common/lib/types' |
||||
|
|
||||
|
import FormattedVal from 'components/base/FormattedVal' |
||||
|
import { SideBarListItem } from 'components/base/SideBar' |
||||
|
|
||||
|
export default class AccountListItem extends PureComponent<{ |
||||
|
account: Account, |
||||
|
push: string => void, |
||||
|
isActive: boolean, |
||||
|
}> { |
||||
|
render() { |
||||
|
const { account, push, isActive } = this.props |
||||
|
const accountURL = `/account/${account.id}` |
||||
|
const item = { |
||||
|
label: account.name, |
||||
|
desc: () => ( |
||||
|
<FormattedVal |
||||
|
alwaysShowSign={false} |
||||
|
color="graphite" |
||||
|
unit={account.unit} |
||||
|
showCode |
||||
|
val={account.balance || 0} |
||||
|
/> |
||||
|
), |
||||
|
iconActiveColor: account.currency.color, |
||||
|
icon: getCryptoCurrencyIcon(account.currency), |
||||
|
onClick: () => push(accountURL), |
||||
|
isActive, |
||||
|
} |
||||
|
return <SideBarListItem {...item} /> |
||||
|
} |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
// @flow
|
||||
|
|
||||
|
import React, { PureComponent } from 'react' |
||||
|
import styled from 'styled-components' |
||||
|
|
||||
|
import { Tabbable } from 'components/base/Box' |
||||
|
import Tooltip from 'components/base/Tooltip' |
||||
|
import IconCirclePlus from 'icons/CirclePlus' |
||||
|
|
||||
|
import { rgba } from 'styles/helpers' |
||||
|
|
||||
|
const PlusWrapper = styled(Tabbable).attrs({ |
||||
|
p: 1, |
||||
|
cursor: 'pointer', |
||||
|
borderRadius: 1, |
||||
|
})` |
||||
|
color: ${p => p.theme.colors.smoke}; |
||||
|
&:hover { |
||||
|
color: ${p => p.theme.colors.dark}; |
||||
|
} |
||||
|
|
||||
|
border: 1px solid transparent; |
||||
|
&:focus { |
||||
|
outline: none; |
||||
|
border-color: ${p => rgba(p.theme.colors.wallet, 0.3)}; |
||||
|
} |
||||
|
` |
||||
|
|
||||
|
export default class AddAccountButton extends PureComponent<{ |
||||
|
onClick: () => void, |
||||
|
tooltipText: string, |
||||
|
}> { |
||||
|
render() { |
||||
|
const { onClick, tooltipText } = this.props |
||||
|
return ( |
||||
|
<Tooltip render={() => tooltipText}> |
||||
|
<PlusWrapper onClick={onClick}> |
||||
|
<IconCirclePlus size={16} /> |
||||
|
</PlusWrapper> |
||||
|
</Tooltip> |
||||
|
) |
||||
|
} |
||||
|
} |
@ -1,3 +1,4 @@ |
|||||
// @flow
|
// @flow
|
||||
|
|
||||
export { default as SideBarList } from './SideBarList' |
export { default as SideBarList } from './SideBarList' |
||||
|
export { default as SideBarListItem } from './SideBarListItem' |
||||
|
Loading…
Reference in new issue