Created
May 12, 2020 01:53
-
-
Save ryanbelke/7ff5a28c52ec2e4f29c0a275fb615cab to your computer and use it in GitHub Desktop.
card section
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