Adding secondary text of token and styling list
This commit is contained in:
parent
a83c340a2c
commit
52674520da
|
@ -29,6 +29,7 @@ const styles = () => ({
|
||||||
'&:focus': {
|
'&:focus': {
|
||||||
outline: 'none',
|
outline: 'none',
|
||||||
},
|
},
|
||||||
|
display: 'grid',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,27 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
import { List } from 'immutable'
|
||||||
import classNames from 'classnames/bind'
|
import classNames from 'classnames/bind'
|
||||||
import SearchBar from 'material-ui-search-bar'
|
import SearchBar from 'material-ui-search-bar'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
|
import MuiList from '@material-ui/core/List'
|
||||||
|
import Img from '~/components/layout/Img'
|
||||||
|
import ListItem from '@material-ui/core/ListItem'
|
||||||
|
import ListItemIcon from '@material-ui/core/ListItemIcon'
|
||||||
|
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'
|
||||||
|
import ListItemText from '@material-ui/core/ListItemText'
|
||||||
import Close from '@material-ui/icons/Close'
|
import Close from '@material-ui/icons/Close'
|
||||||
import Search from '@material-ui/icons/Search'
|
import Search from '@material-ui/icons/Search'
|
||||||
import IconButton from '@material-ui/core/IconButton'
|
import IconButton from '@material-ui/core/IconButton'
|
||||||
import Paragraph from '~/components/layout/Paragraph'
|
import Paragraph from '~/components/layout/Paragraph'
|
||||||
import Button from '~/components/layout/Button'
|
import Button from '~/components/layout/Button'
|
||||||
|
import Switch from '@material-ui/core/Switch'
|
||||||
import Divider from '~/components/layout/Divider'
|
import Divider from '~/components/layout/Divider'
|
||||||
import Hairline from '~/components/layout/Hairline'
|
import Hairline from '~/components/layout/Hairline'
|
||||||
import Spacer from '~/components/Spacer'
|
import Spacer from '~/components/Spacer'
|
||||||
import Row from '~/components/layout/Row'
|
import Row from '~/components/layout/Row'
|
||||||
import { lg, md, sm, xs, mediumFontSize } from '~/theme/variables'
|
import { lg, md, sm, xs, mediumFontSize, border } from '~/theme/variables'
|
||||||
|
import { type Token } from '~/routes/tokens/store/model/token'
|
||||||
|
|
||||||
const styles = () => ({
|
const styles = () => ({
|
||||||
heading: {
|
heading: {
|
||||||
|
@ -41,6 +50,14 @@ const styles = () => ({
|
||||||
paddingRight: md,
|
paddingRight: md,
|
||||||
paddingLeft: md,
|
paddingLeft: md,
|
||||||
},
|
},
|
||||||
|
list: {
|
||||||
|
overflow: 'hidden',
|
||||||
|
overflowY: 'scroll',
|
||||||
|
},
|
||||||
|
token: {
|
||||||
|
minHeight: '50px',
|
||||||
|
borderBottom: `1px solid ${border}`,
|
||||||
|
},
|
||||||
searchInput: {
|
searchInput: {
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
lineHeight: 'initial',
|
lineHeight: 'initial',
|
||||||
|
@ -77,6 +94,7 @@ const styles = () => ({
|
||||||
type Props = {
|
type Props = {
|
||||||
onClose: () => void,
|
onClose: () => void,
|
||||||
classes: Object,
|
classes: Object,
|
||||||
|
tokens: List<Token>,
|
||||||
}
|
}
|
||||||
|
|
||||||
class Tokens extends React.Component<Props> {
|
class Tokens extends React.Component<Props> {
|
||||||
|
@ -86,7 +104,7 @@ class Tokens extends React.Component<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { onClose, classes } = this.props
|
const { onClose, classes, tokens } = this.props
|
||||||
const searchClasses = {
|
const searchClasses = {
|
||||||
input: classes.searchInput,
|
input: classes.searchInput,
|
||||||
root: classes.searchRoot,
|
root: classes.searchRoot,
|
||||||
|
@ -119,6 +137,22 @@ class Tokens extends React.Component<Props> {
|
||||||
</Button>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
<Hairline />
|
<Hairline />
|
||||||
|
<MuiList className={classes.list}>
|
||||||
|
{tokens.map((token: Token) => (
|
||||||
|
<ListItem key={token.get('address')} className={classes.token}>
|
||||||
|
<ListItemIcon>
|
||||||
|
<Img src={token.get('logoUrl')} height={28} alt={token.get('name')} />
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText primary={token.get('symbol')} secondary={token.get('name')} />
|
||||||
|
<ListItemSecondaryAction>
|
||||||
|
<Switch
|
||||||
|
onChange={undefined}
|
||||||
|
checked
|
||||||
|
/>
|
||||||
|
</ListItemSecondaryAction>
|
||||||
|
</ListItem>
|
||||||
|
))}
|
||||||
|
</MuiList>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,11 @@ import Paragraph from '~/components/layout/Paragraph'
|
||||||
import Modal from '~/components/Modal'
|
import Modal from '~/components/Modal'
|
||||||
import { type Column, cellWidth } from '~/components/Table/TableHead'
|
import { type Column, cellWidth } from '~/components/Table/TableHead'
|
||||||
import Table from '~/components/Table'
|
import Table from '~/components/Table'
|
||||||
import { sm, xs } from '~/theme/variables'
|
|
||||||
import { getBalanceData, generateColumns, BALANCE_TABLE_ASSET_ID, type BalanceRow, filterByZero } from './dataFetcher'
|
import { getBalanceData, generateColumns, BALANCE_TABLE_ASSET_ID, type BalanceRow, filterByZero } from './dataFetcher'
|
||||||
import Tokens from './Tokens'
|
import Tokens from './Tokens'
|
||||||
import Send from './Send'
|
import Send from './Send'
|
||||||
import Receive from './Receive'
|
import Receive from './Receive'
|
||||||
|
import { styles } from './style'
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
hideZero: boolean,
|
hideZero: boolean,
|
||||||
|
@ -29,55 +29,6 @@ type State = {
|
||||||
showSend: boolean,
|
showSend: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = theme => ({
|
|
||||||
root: {
|
|
||||||
width: '20px',
|
|
||||||
marginRight: sm,
|
|
||||||
},
|
|
||||||
zero: {
|
|
||||||
letterSpacing: '-0.5px',
|
|
||||||
},
|
|
||||||
message: {
|
|
||||||
margin: `${sm} 0`,
|
|
||||||
},
|
|
||||||
actionIcon: {
|
|
||||||
marginRight: theme.spacing.unit,
|
|
||||||
},
|
|
||||||
iconSmall: {
|
|
||||||
fontSize: 16,
|
|
||||||
},
|
|
||||||
hide: {
|
|
||||||
'&:hover': {
|
|
||||||
backgroundColor: '#fff3e2',
|
|
||||||
},
|
|
||||||
'&:hover $actions': {
|
|
||||||
visibility: 'initial',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
justifyContent: 'flex-end',
|
|
||||||
visibility: 'hidden',
|
|
||||||
},
|
|
||||||
send: {
|
|
||||||
minWidth: '0px',
|
|
||||||
marginRight: sm,
|
|
||||||
width: '70px',
|
|
||||||
},
|
|
||||||
receive: {
|
|
||||||
minWidth: '0px',
|
|
||||||
width: '95px',
|
|
||||||
},
|
|
||||||
leftIcon: {
|
|
||||||
marginRight: xs,
|
|
||||||
},
|
|
||||||
links: {
|
|
||||||
textDecoration: 'underline',
|
|
||||||
'&:hover': {
|
|
||||||
cursor: 'pointer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
granted: boolean,
|
granted: boolean,
|
||||||
|
@ -89,7 +40,7 @@ type Action = 'Token' | 'Send' | 'Receive'
|
||||||
class Balances extends React.Component<Props, State> {
|
class Balances extends React.Component<Props, State> {
|
||||||
state = {
|
state = {
|
||||||
hideZero: false,
|
hideZero: false,
|
||||||
showToken: false,
|
showToken: true,
|
||||||
showSend: false,
|
showSend: false,
|
||||||
showReceive: false,
|
showReceive: false,
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
// @flow
|
||||||
|
import { sm, xs } from '~/theme/variables'
|
||||||
|
|
||||||
|
export const styles = (theme: Object) => ({
|
||||||
|
root: {
|
||||||
|
width: '20px',
|
||||||
|
marginRight: sm,
|
||||||
|
},
|
||||||
|
zero: {
|
||||||
|
letterSpacing: '-0.5px',
|
||||||
|
},
|
||||||
|
message: {
|
||||||
|
margin: `${sm} 0`,
|
||||||
|
},
|
||||||
|
actionIcon: {
|
||||||
|
marginRight: theme.spacing.unit,
|
||||||
|
},
|
||||||
|
iconSmall: {
|
||||||
|
fontSize: 16,
|
||||||
|
},
|
||||||
|
hide: {
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: '#fff3e2',
|
||||||
|
},
|
||||||
|
'&:hover $actions': {
|
||||||
|
visibility: 'initial',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
visibility: 'hidden',
|
||||||
|
},
|
||||||
|
send: {
|
||||||
|
minWidth: '0px',
|
||||||
|
marginRight: sm,
|
||||||
|
width: '70px',
|
||||||
|
},
|
||||||
|
receive: {
|
||||||
|
minWidth: '0px',
|
||||||
|
width: '95px',
|
||||||
|
},
|
||||||
|
leftIcon: {
|
||||||
|
marginRight: xs,
|
||||||
|
},
|
||||||
|
links: {
|
||||||
|
textDecoration: 'underline',
|
||||||
|
'&:hover': {
|
||||||
|
cursor: 'pointer',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
|
@ -181,6 +181,19 @@ export default createMuiTheme({
|
||||||
backgroundColor: 'rgba(228, 232, 241, 0.75)',
|
backgroundColor: 'rgba(228, 232, 241, 0.75)',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
MuiListItemText: {
|
||||||
|
primary: {
|
||||||
|
fontFamily: 'Roboto Mono, monospace',
|
||||||
|
fontSize: mediumFontSize,
|
||||||
|
fontWeight: bolderFont,
|
||||||
|
color: primary,
|
||||||
|
},
|
||||||
|
secondary: {
|
||||||
|
fontFamily: 'Roboto Mono, monospace',
|
||||||
|
fontSize: smallFontSize,
|
||||||
|
color: disabled,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
palette,
|
palette,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue