Created
March 18, 2014 10:43
-
-
Save danielmahal/9617681 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
var DeliveryAddress = React.createClass({ | |
getInitialState: function() { | |
return { | |
preset: '2' | |
} | |
}, | |
changePreset: function(e) { | |
this.setState({ preset: e.target.value }) | |
}, | |
render: function() { | |
var presets, | |
newAddress | |
if(this.props.user) { | |
presets = <RadioGroup handleChange={this.changePreset}> | |
<Radio name="deliveryPreset" key="2" checked>Daniel Mahal, Theresesgate 3, 0185 Oslo</Radio> | |
<Radio name="deliveryPreset" key="new">Annen adresse</Radio> | |
</RadioGroup> | |
} | |
if(!this.props.user || this.state.preset === 'new') { | |
newAddress = <div> | |
<input type="text" className="name" placeholder="Navn" /> | |
<input type="text" placeholder="Adresse" /> | |
<input type="text" className="postal-code" placeholder="Postnr." /> | |
<input type="text" className="postal-area" placeholder="Poststed." /> | |
</div> | |
} | |
return ( | |
<fieldset className="address"> | |
<legend>Leveringsadresse</legend> | |
{presets} | |
{newAddress} | |
</fieldset> | |
) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment