Last active
April 5, 2018 06:00
-
-
Save cristianoliveira/bfc604f24763cf07aeb27533730ef92e 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 | |
const COUNTRY_REGIONS = { IE:[], SP:[], IT:[] }; | |
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 /> | |
<PostCodeInput name="post_code" value={props.post_code} /> | |
<CityInput name="city" value={props.city} /> | |
{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