Last active
April 5, 2018 05:58
-
-
Save cristianoliveira/f65c4c3039cf0b347cf2244ec8a01b9b to your computer and use it in GitHub Desktop.
Same same but different - post
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
// CountryAddressForm.js | |
render() { | |
return ( | |
<form action="#" | |
onSubmit={this.handleSubmit.bind(this)} | |
onChange={this.handleChange.bind(this)}> | |
<CountrySelector name="country" countries={countries} /> | |
<AddressLineInput name="address_line" value={this.state.address_line} /> | |
{this.state.country === 'BR' && <StreetNumberInput name="street_no" />} | |
{this.state.country === 'BR' && this.state.address_line && ( | |
<WarningMessage text="address_form.fill_form" />) | |
} | |
<AddressLineInput name="address_line2" value={props.address_line2} optional /> | |
{['SE', 'DE'].indexOf(this.state.country) >= 0 ? ( | |
<div> | |
<PostCodeInput name="post_code" value={this.state.post_code} /> | |
<CityInput name="city" value={this.state.city} /> | |
</div> | |
) : ( | |
<div> | |
<CityInput name="city" value={this.state.city} /> | |
<PostCodeInput name="post_code" value={this.state.post_code} /> | |
</div> | |
)} | |
{COUNTRY_REGIONS[this.state.country] && ( | |
<RegionSelector | |
name="region" | |
regions={formatRegions(COUNTRY_REGIONS[this.state.country])} />) | |
} | |
<button>Submit</button> | |
</form> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment