Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Last active June 24, 2016 09:04
Show Gist options
  • Save ryanflorence/029c694fdaab9ae6881b2a73305528a9 to your computer and use it in GitHub Desktop.
Save ryanflorence/029c694fdaab9ae6881b2a73305528a9 to your computer and use it in GitHub Desktop.
const Pricing = React.createClass({
// ...
render() {
// ...
return (
<div className="pricing" style={{ opacity: purchasing ? 0.25 : '' }}>
{purchaseError ? (
<div className="purchase-complete">
<h2 style={{ color: 'hsl(10, 50%, 50%)' }}>Oops!</h2>
<p>
Sorry, there was an unkown error with the server, please try
again or email us at hello@reactjs-training.com to work out
payment a different way.
</p>
<p>
<button
className="cta-button outlined-button"
onClick={() => this.replaceState(this.getInitialState())}
>
Try again
</button>
</p>
</div>
) : purchaseComplete ? (
<div className="purchase-complete">
<h2>Thanks!</h2>
<p>
Thank you for your purchase of {formatPrice(this.state.total)}.
We’ll send you a receipt shortly.
</p>
<p>
<button
className="cta-button outlined-button"
onClick={() => this.replaceState(this.getInitialState())}
>
Buy more tickets
</button>
</p>
</div>
) : seatsAvailable ? (
promoAvailable ? (
<PurchaseBlock
training={training}
price={promo}
regularPrice={regular}
title={`Promo: ${query.c}`}
getAvailableSeats={() => getAvailableSeatsWithPromo(training, promo)}
onPurchase={this.purchaseWithPromo}
/>
) : earlyBirdAvailable ? (
<PurchaseBlock
training={training}
price={earlyBird}
regularPrice={regular}
title="Early Bird Price"
getAvailableSeats={() => getAvailableSeats(training)}
onPurchase={this.purchaseEarlyBird}
/>
) : (
<PurchaseBlock
training={training}
price={regular}
title="Ticket Price"
getAvailableSeats={() => getAvailableSeats(training)}
onPurchase={this.purchaseRegular}
/>
)
) : (
<SoldOut training={training}/>
)}
</div>
)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment