Created
May 3, 2020 20:31
-
-
Save ryanbelke/39c5e26bf427144f186ee94b78ffdb11 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 } from "@stripe/react-stripe-js"; | |
| function CardSection(props) { | |
| 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 | |
| options={{ | |
| style: { width: "100%", base: { fontSize: "18px" } }, | |
| }} | |
| /> | |
| </div> | |
| <br /> | |
| <div className="order-button-wrapper"> | |
| <button onClick={props.submitOrder}>Confirm order</button> | |
| </div> | |
| {props.stripeError ? ( | |
| <div>{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 CardSection; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment