Created
February 29, 2016 23:15
-
-
Save marr/f03788045965a9957ae7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import AccountDetail from 'components/AccountDetail' | |
import CustomerForm from 'components/CustomerForm' | |
import CustomerPanel from 'components/CustomerPanel' | |
import SecurityPanel from 'components/SecurityPanel' | |
class Account extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
isEditing: true | |
} | |
this.edit = this.edit.bind(this) | |
this.handleEdit = this.handleEdit.bind(this) | |
} | |
edit(e) { | |
this.setState({ isEditing: true }) | |
} | |
handleEdit(e) { | |
debugger // never hit | |
} | |
render() { | |
const { guest } = this.props | |
const { account, centre } = guest | |
const isEditing = this.state.isEditing | |
const form = { | |
initialValues: account, | |
handleSubmit: this.handleEdit | |
} | |
return ( | |
<div className="guest-detail"> | |
<h2>Account</h2> | |
<div className="col"> | |
{ (isEditing) ? <CustomerForm {...form} /> : ( | |
<CustomerPanel {...account} onEditClick={this.edit} /> | |
) } | |
<SecurityPanel {...account} /> | |
</div> | |
<div className="col"> | |
<AccountDetail {...account} centre={centre} /> | |
</div> | |
</div> | |
) | |
} | |
} | |
export default Account |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment