Created
October 13, 2018 01:05
-
-
Save ryanbelke/655e1ff66291490292d303f4f311bc44 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* components/Checkout/cardsection.js */ | |
import React from "react"; | |
import { CardElement, CardNumberElement } from "react-stripe-elements"; | |
import { injectStripe } from "react-stripe-elements"; | |
class CardSection extends React.Component { | |
render() { | |
return ( | |
<div> | |
<div> | |
<label htmlFor="card-element">Credit or debit card</label> | |
<div> | |
<fieldset style={{ border: "none" }}> | |
<div className="form-row"> | |
<div id="card-element" style={{ width: "100%" }}> | |
<CardElement | |
style={{ width: "100%", base: { fontSize: "18px" } }} | |
/> | |
</div> | |
<br /> | |
<div className="order-button-wrapper"> | |
<button onClick={this.props.submitOrder}> | |
Confirm order | |
</button> | |
</div> | |
{this.props.stripeError ? ( | |
<div>{this.props.stripeError.toString()}</div> | |
) : null} | |
<div id="card-errors" role="alert" /> | |
</div> | |
</fieldset> | |
</div> | |
</div> | |
<style jsx> | |
{` | |
.order-button-wrapper { | |
display: flex; | |
width: 100%; | |
align-items: flex-end; | |
justify-content: flex-end; | |
} | |
`} | |
</style> | |
</div> | |
); | |
} | |
} | |
export default injectStripe(CardSection); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment