Browse Source

Use icons from api for apps list

master
meriadec 7 years ago
parent
commit
e9ee951d38
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 18
      src/components/ManagerPage/ManagerApp.js
  2. 8
      src/components/ManagerPage/index.js

18
src/components/ManagerPage/ManagerApp.js

@ -9,27 +9,39 @@ import Text from 'components/base/Text'
const Container = styled(Box).attrs({ const Container = styled(Box).attrs({
align: 'center', align: 'center',
justify: 'center', justify: 'center',
m: 1, m: 2,
})` })`
width: 150px; width: 150px;
height: 150px; height: 150px;
background: rgba(0, 0, 0, 0.05); background: white;
` `
// https://api.ledgerwallet.com/update/assets/icons/bitcoin
const ActionBtn = styled(Tabbable).attrs({ const ActionBtn = styled(Tabbable).attrs({
fontSize: 3, fontSize: 3,
})`` })``
const AppIcon = styled.img`
display: block;
width: 50px;
height: 50px;
`
type Props = { type Props = {
name: string, name: string,
icon: string,
onInstall: Function, onInstall: Function,
onUninstall: Function, onUninstall: Function,
} }
export default function ManagerApp(props: Props) { export default function ManagerApp(props: Props) {
const { name, onInstall, onUninstall } = props const { name, icon, onInstall, onUninstall } = props
const iconUrl = `https://api.ledgerwallet.com/update/assets/icons/${icon}`
return ( return (
<Container flow={3}> <Container flow={3}>
<AppIcon src={iconUrl} />
<Text ff="Museo Sans|Bold">{name}</Text> <Text ff="Museo Sans|Bold">{name}</Text>
<Box horizontal flow={2}> <Box horizontal flow={2}>
<ActionBtn onClick={onInstall}>{'Install'}</ActionBtn> <ActionBtn onClick={onInstall}>{'Install'}</ActionBtn>

8
src/components/ManagerPage/index.js

@ -17,9 +17,13 @@ import Modal, { ModalBody } from 'components/base/Modal'
import ManagerApp from './ManagerApp' import ManagerApp from './ManagerApp'
const ICONS_FALLBACK = {
bitcoin_testnet: 'bitcoin',
}
const List = styled(Box).attrs({ const List = styled(Box).attrs({
horizontal: true, horizontal: true,
m: -1, m: -2,
})` })`
flex-wrap: wrap; flex-wrap: wrap;
` `
@ -36,6 +40,7 @@ type Status = 'loading' | 'idle' | 'busy' | 'success' | 'error'
type LedgerApp = { type LedgerApp = {
name: string, name: string,
icon: string,
app: Object, app: Object,
} }
@ -107,6 +112,7 @@ class ManagerPage extends PureComponent<Props, State> {
<ManagerApp <ManagerApp
key={c.name} key={c.name}
name={c.name} name={c.name}
icon={ICONS_FALLBACK[c.icon] || c.icon}
onInstall={this.handleInstall(c)} onInstall={this.handleInstall(c)}
onUninstall={this.handleUninstall(c)} onUninstall={this.handleUninstall(c)}
/> />

Loading…
Cancel
Save