Improve Safe settings styles

This commit is contained in:
Germán Martínez 2019-05-27 14:59:04 +02:00
parent fcbb02e56f
commit 20d038ebfa
6 changed files with 56 additions and 25 deletions

View File

@ -7,6 +7,7 @@
align-items: center; align-items: center;
border: solid 0.5px $border; border: solid 0.5px $border;
background-color: white; background-color: white;
margin-top: 50px;
} }
@media only screen and (max-width: $(screenXs)px) { @media only screen and (max-width: $(screenXs)px) {

View File

@ -40,7 +40,6 @@ export const generateColumns = () => {
order: false, order: false,
disablePadding: false, disablePadding: false,
label: 'Address', label: 'Address',
width: 350,
custom: false, custom: false,
align: 'left', align: 'left',
} }
@ -50,7 +49,6 @@ export const generateColumns = () => {
order: false, order: false,
disablePadding: false, disablePadding: false,
label: '', label: '',
align: 'right',
custom: true, custom: true,
} }

View File

@ -27,6 +27,9 @@ import {
} from './dataFetcher' } from './dataFetcher'
import { sm, boldFont } from '~/theme/variables' import { sm, boldFont } from '~/theme/variables'
import { styles } from './style' import { styles } from './style'
import ReplaceOwnerIcon from './assets/icons/replace-owner.svg'
import RenameOwnerIcon from './assets/icons/rename-owner.svg'
import RemoveOwnerIcon from '../assets/icons/bin.svg'
const controlsStyle = { const controlsStyle = {
backgroundColor: 'white', backgroundColor: 'white',
@ -52,15 +55,26 @@ type Action = 'AddOwner' | 'EditOwner' | 'ReplaceOwner' | 'RemoveOwner'
class ManageOwners extends React.Component<Props, State> { class ManageOwners extends React.Component<Props, State> {
state = { state = {
selectedOwnerAddress: undefined,
selectedOwnerName: undefined,
showAddOwner: false, showAddOwner: false,
showRemoveOwner: false,
} }
onShow = (action: Action) => () => { onShow = (action: Action, row?: Object) => () => {
this.setState(() => ({ [`show${action}`]: true })) this.setState({
[`show${action}`]: true,
selectedOwnerAddress: row && row.address,
selectedOwnerName: row && row.name,
})
} }
onHide = (action: Action) => () => { onHide = (action: Action) => () => {
this.setState(() => ({ [`show${action}`]: false })) this.setState({
[`show${action}`]: false,
selectedOwnerAddress: undefined,
selectedOwnerName: undefined,
})
} }
render() { render() {
@ -74,9 +88,15 @@ class ManageOwners extends React.Component<Props, State> {
userAddress, userAddress,
createTransaction, createTransaction,
} = this.props } = this.props
const { showAddOwner } = this.state const {
showAddOwner,
showRemoveOwner,
selectedOwnerName,
selectedOwnerAddress
} = this.state
const columns = generateColumns() const columns = generateColumns()
const autoColumns = columns.filter(c => !c.custom)
const ownerData = getOwnerData(owners) const ownerData = getOwnerData(owners)
return ( return (
@ -85,7 +105,6 @@ class ManageOwners extends React.Component<Props, State> {
<Paragraph noMargin className={classes.title} size="lg" weight="bolder"> <Paragraph noMargin className={classes.title} size="lg" weight="bolder">
Manage Safe Owners Manage Safe Owners
</Paragraph> </Paragraph>
<Table <Table
label="owners" label="owners"
columns={columns} columns={columns}
@ -96,28 +115,16 @@ class ManageOwners extends React.Component<Props, State> {
> >
{(sortedData: Array<OwnerRow>) => sortedData.map((row: any, index: number) => ( {(sortedData: Array<OwnerRow>) => sortedData.map((row: any, index: number) => (
<TableRow tabIndex={-1} key={index} className={classes.hide}> <TableRow tabIndex={-1} key={index} className={classes.hide}>
{columns.map((column: Column) => ( {autoColumns.map((column: Column) => (
<TableCell key={column.id} style={cellWidth(column.width)} align={column.align} component="td"> <TableCell key={column.id} style={cellWidth(column.width)} align={column.align} component="td">
{column.id === OWNERS_TABLE_ADDRESS_ID ? <OwnerAddressTableCell address={row[column.id]} /> : row[column.id]} {column.id === OWNERS_TABLE_ADDRESS_ID ? <OwnerAddressTableCell address={row[column.id]} /> : row[column.id]}
</TableCell> </TableCell>
))} ))}
<TableCell component="td"> <TableCell component="td">
<Row align="end" className={classes.actions}> <Row align="end" className={classes.actions}>
<Button <img className={classes.editOwnerIcon} src={RenameOwnerIcon} onClick={this.onShow('EditOwner', row)} />
onClick={this.onShow('EditOwner')} <img className={classes.replaceOwnerIcon} src={ReplaceOwnerIcon} onClick={this.onShow('ReplaceOwner', row)} />
> <img className={classes.removeOwnerIcon} src={RemoveOwnerIcon} onClick={this.onShow('RemoveOwner', row)} />
Edit
</Button>
<Button
onClick={this.onShow('ReplaceOwner')}
>
Replace
</Button>
<Button
onClick={this.onShow('RemoveOwner')}
>
Remove
</Button>
</Row> </Row>
</TableCell> </TableCell>
</TableRow> </TableRow>

View File

@ -26,4 +26,15 @@ export const styles = () => ({
justifyContent: 'flex-end', justifyContent: 'flex-end',
visibility: 'hidden', visibility: 'hidden',
}, },
editOwnerIcon: {
cursor: 'pointer',
},
replaceOwnerIcon: {
marginLeft: lg,
cursor: 'pointer',
},
removeOwnerIcon: {
marginLeft: lg,
cursor: 'pointer',
},
}) })

View File

@ -16,6 +16,7 @@ import UpdateSafeName from './UpdateSafeName'
import ManageOwners from './ManageOwners' import ManageOwners from './ManageOwners'
import actions, { type Actions } from './actions' import actions, { type Actions } from './actions'
import { styles } from './style' import { styles } from './style'
import RemoveSafeIcon from './assets/icons/bin.svg'
type State = { type State = {
showRemoveSafe: boolean, showRemoveSafe: boolean,
@ -80,9 +81,12 @@ class Settings extends React.Component<Props, State> {
</Paragraph> </Paragraph>
</Col> </Col>
<Col xs={6} end="sm"> <Col xs={6} end="sm">
<Paragraph noMargin size="md" color="error" className={classes.links} onClick={this.onShow('RemoveSafe')}> <Paragraph noMargin size="md" color="error" onClick={this.onShow('RemoveSafe')}>
<Paragraph noMargin className={cn(classes.links, classes.removeSafeText)}>
Remove Safe Remove Safe
</Paragraph> </Paragraph>
<img className={classes.removeSafeIcon} src={RemoveSafeIcon} />
</Paragraph>
<RemoveSafeModal <RemoveSafeModal
onClose={this.onHide('RemoveSafe')} onClose={this.onHide('RemoveSafe')}
isOpen={showRemoveSafe} isOpen={showRemoveSafe}

View File

@ -39,4 +39,14 @@ export const styles = (theme: Object) => ({
cursor: 'pointer', cursor: 'pointer',
}, },
}, },
removeSafeText: {
height: '16px',
lineHeight: '16px',
paddingRight: sm,
float: 'left',
},
removeSafeIcon: {
height: '16px',
cursor: 'pointer',
},
}) })