Implementation of adding new owner

This commit is contained in:
apanizo 2018-10-03 12:01:03 +02:00
parent 9e6c97aea8
commit d4557e8515
1 changed files with 55 additions and 44 deletions

View File

@ -39,6 +39,9 @@ const styles = () => ({
padding: `${md} ${lg}`, padding: `${md} ${lg}`,
}, },
owner: { owner: {
padding: `0 ${lg}`,
},
header: {
padding: `${sm} ${lg}`, padding: `${sm} ${lg}`,
}, },
name: { name: {
@ -97,6 +100,12 @@ class SafeOwners extends React.Component<Props, State> {
})) }))
} }
onAddOwner = () => {
this.setState(state => ({
numOwners: state.numOwners + 1,
}))
}
render() { render() {
const { classes, errors, otherAccounts } = this.props const { classes, errors, otherAccounts } = this.props
const { numOwners } = this.state const { numOwners } = this.state
@ -109,11 +118,12 @@ class SafeOwners extends React.Component<Props, State> {
</Paragraph> </Paragraph>
</Block> </Block>
<Hairline /> <Hairline />
<Row className={classes.owner}> <Row className={classes.header}>
<Col xs={4}>NAME</Col> <Col xs={4}>NAME</Col>
<Col xs={8}>ADDRESS</Col> <Col xs={8}>ADDRESS</Col>
</Row> </Row>
<Hairline /> <Hairline />
<Block margin="md">
{ [...Array(Number(numOwners))].map((x, index) => { { [...Array(Number(numOwners))].map((x, index) => {
const addressName = getOwnerAddressBy(index) const addressName = getOwnerAddressBy(index)
@ -157,8 +167,9 @@ class SafeOwners extends React.Component<Props, State> {
</Row> </Row>
) )
}) } }) }
</Block>
<Row align="center" grow className={classes.add} margin="xl"> <Row align="center" grow className={classes.add} margin="xl">
<Button color="secondary"> <Button color="secondary" onClick={this.onAddOwner}>
+ ADD ANOTHER OWNER + ADD ANOTHER OWNER
</Button> </Button>
</Row> </Row>