Unverified Commit d5222f85 authored by Thor's avatar Thor Committed by GitHub

Add global CSS styles to example/with-stripe-typescript (#10520)

* Update stripe-node.

* Update casting.

* Add global CSS styles 💅

* Remove emojies from README.

* Add twitter meta.

* Add demo gifs to README.

* Solid card icon.

* lint fix
Co-authored-by: 's avatarLuis Alvarez D. <luis@zeit.co>
parent 2e8d6380
# Example using Stripe with TypeScript and react-stripe-js 🔒💸
# Example using Stripe with TypeScript and react-stripe-js
- Demo: https://nextjs-typescript-react-stripe-js.now.sh/
- CodeSandbox: https://codesandbox.io/s/nextjs-typescript-react-stripe-js-rqrss
- CodeSandbox: https://codesandbox.io/s/github/stripe-samples/nextjs-typescript-react-stripe-js
- Tutorial: https://dev.to/thorwebdev/type-safe-payments-with-next-js-typescript-and-stripe-4jo7
This is a full-stack TypeScript example using:
......@@ -13,8 +13,27 @@ This is a full-stack TypeScript example using:
- Next.js [API routes](https://nextjs.org/docs/api-routes/introduction)
- [stripe-node with TypeScript](https://github.com/stripe/stripe-node#usage-with-typescript)
**Demo**
See the sample [live](https://nextjs-typescript-react-stripe-js.now.sh/) or [fork](https://codesandbox.io/s/github/stripe-samples/nextjs-typescript-react-stripe-js) on CodeSandbox.
The demo is running in test mode -- use `4242424242424242` as a test card number with any CVC + future expiration date.
Use the `4000000000003220` test card number to trigger a 3D Secure challenge flow.
Read more about testing on Stripe at https://stripe.com/docs/testing.
<details open><summary>Checkout Demo</summary>
<img src="./public/checkout_demo.gif" alt="A gif of the Checkout payment page." align="center">
</details>
<details><summary>Elements Demo</summary>
<img src="./public/elements_demo.gif" alt="A gif of the custom Elements checkout page." align="center">
</details>
### Included functionality
- [Global CSS styles](https://nextjs.org/blog/next-9-2#built-in-css-support-for-global-stylesheets)
- Making `.env` variables available to next: [next.config.js](next.config.js)
- **Note**: When deploying with Now you need to [add your secrets](https://zeit.co/docs/v2/serverless-functions/env-and-secrets) and specify a [now.json](/now.json) file.
- Implementation of a Layout component that loads and sets up Stripe.js and Elements for usage with SSR via `loadStripe` helper: [components/Layout.tsx](components/Layout.tsx).
......@@ -116,3 +135,8 @@ now secrets add stripe_webhook_secret whsec_***
```
As the secrets are set as env vars in the project at deploy time, we will need to redeploy our app after we made changes to the secrets.
### Authors
- [@thorsten-stripe](https://twitter.com/thorwebdev)
- [@lfades](https://twitter.com/luis_fades)
......@@ -9,7 +9,9 @@ import * as config from '../config'
import { useStripe } from '@stripe/react-stripe-js'
const CheckoutForm: React.FunctionComponent = () => {
const [input, setInput] = useState({ customDonation: config.MIN_AMOUNT })
const [input, setInput] = useState({
customDonation: Math.round(config.MAX_AMOUNT / config.AMOUNT_STEP),
})
const stripe = useStripe()
const handleInputChange: React.ChangeEventHandler<HTMLInputElement> = e =>
......@@ -46,6 +48,7 @@ const CheckoutForm: React.FunctionComponent = () => {
return (
<form onSubmit={handleSubmit}>
<CustomDonationInput
className="checkout-style"
name={'customDonation'}
value={input.customDonation}
min={config.MIN_AMOUNT}
......@@ -54,7 +57,11 @@ const CheckoutForm: React.FunctionComponent = () => {
currency={config.CURRENCY}
onChange={handleInputChange}
/>
<button type="submit" disabled={!stripe}>
<button
className="checkout-style-background"
type="submit"
disabled={!stripe}
>
Donate {formatAmountForDisplay(input.customDonation, config.CURRENCY)}
</button>
</form>
......
......@@ -9,6 +9,7 @@ type Props = {
currency: string
step: number
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void
className?: string
}
const CustomDonationInput: React.FunctionComponent<Props> = ({
......@@ -19,11 +20,13 @@ const CustomDonationInput: React.FunctionComponent<Props> = ({
currency,
step,
onChange,
className,
}) => (
<label>
Custom donation amount ({formatAmountForDisplay(min, currency)}-
{formatAmountForDisplay(max, currency)}):
<input
className={className}
type="number"
name={name}
value={value}
......@@ -32,6 +35,15 @@ const CustomDonationInput: React.FunctionComponent<Props> = ({
step={step}
onChange={onChange}
></input>
<input
type="range"
name={name}
value={value}
min={min}
max={max}
step={step}
onChange={onChange}
></input>
</label>
)
......
......@@ -9,9 +9,33 @@ import * as config from '../config'
import { CardElement, useStripe, useElements } from '@stripe/react-stripe-js'
const CARD_OPTIONS = {
iconStyle: 'solid' as const,
style: {
base: {
iconColor: '#6772e5',
color: '#6772e5',
fontWeight: '500',
fontFamily: 'Roboto, Open Sans, Segoe UI, sans-serif',
fontSize: '16px',
fontSmoothing: 'antialiased',
':-webkit-autofill': {
color: '#fce883',
},
'::placeholder': {
color: '#6772e5',
},
},
invalid: {
iconColor: '#ef2961',
color: '#ef2961',
},
},
}
const ElementsForm: React.FunctionComponent = () => {
const [input, setInput] = useState({
customDonation: config.MIN_AMOUNT,
customDonation: Math.round(config.MAX_AMOUNT / config.AMOUNT_STEP),
cardholderName: '',
})
const [payment, setPayment] = useState({ status: 'initial' })
......@@ -36,7 +60,7 @@ const ElementsForm: React.FunctionComponent = () => {
return (
<>
<h2>Error 😭</h2>
<p>{errorMessage}</p>
<p className="error-message">{errorMessage}</p>
</>
)
......@@ -53,6 +77,8 @@ const ElementsForm: React.FunctionComponent = () => {
const handleSubmit: React.FormEventHandler<HTMLFormElement> = async e => {
e.preventDefault()
// Abort if form isn't valid
if (!e.currentTarget.reportValidity()) return
setPayment({ status: 'processing' })
// Create a PaymentIntent with the specified amount.
......@@ -95,6 +121,7 @@ const ElementsForm: React.FunctionComponent = () => {
<>
<form onSubmit={handleSubmit}>
<CustomDonationInput
className="elements-style"
name="customDonation"
value={input.customDonation}
min={config.MIN_AMOUNT}
......@@ -103,35 +130,30 @@ const ElementsForm: React.FunctionComponent = () => {
currency={config.CURRENCY}
onChange={handleInputChange}
/>
<fieldset>
<fieldset className="elements-style">
<legend>Your payment details:</legend>
<label>
Cardholder name:
<input
type="Text"
name="cardholderName"
onChange={handleInputChange}
required={true}
/>
</label>
<CardElement
options={{
style: {
base: {
fontSize: '16px',
color: '#424770',
'::placeholder': {
color: '#aab7c4',
},
},
invalid: {
color: '#9e2146',
},
},
}}
<input
placeholder="Cardholder name"
className="elements-style"
type="Text"
name="cardholderName"
onChange={handleInputChange}
required
/>
<div className="FormRow elements-style">
<CardElement
options={CARD_OPTIONS}
onChange={e => {
if (e.error) {
setPayment({ status: 'error' })
setErrorMessage(e.error.message ?? 'An unknown error occured')
}
}}
/>
</div>
</fieldset>
<button
className="elements-style-background"
type="submit"
disabled={
!['initial', 'succeeded', 'error'].includes(payment.status) ||
......
import React from 'react'
import Link from 'next/link'
import Head from 'next/head'
import Link from 'next/link'
import { Elements } from '@stripe/react-stripe-js'
import { loadStripe } from '@stripe/stripe-js'
......@@ -19,25 +19,36 @@ const Layout: React.FunctionComponent<Props> = ({
<title>{title}</title>
<meta charSet="utf-8" />
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@thorwebdev" />
<meta name="twitter:title" content="TypeScript Next.js Stripe Example" />
<meta
name="twitter:description"
content="Full-stack TypeScript example using Next.js, react-stripe-js, and stripe-node."
/>
<meta
name="twitter:image"
content="https://nextjs-typescript-react-stripe-js.now.sh/social_card.png"
/>
</Head>
<header>
<nav>
<Link href="/">
<a>Home</a>
</Link>{' '}
|{' '}
<Link href="/donate-with-checkout">
<a>Donate with Checkout</a>
</Link>{' '}
|{' '}
<Link href="/donate-with-elements">
<a>Donate with Elements</a>
</Link>
</nav>
</header>
{children}
<footer>
<hr />
<div className="container">
<header>
<div className="header-content">
<Link href="/">
<a className="logo">
<img src="/logo.png" />
</a>
</Link>
<h1>
<span className="light">Stripe Sample</span>
<br />
Next.js, TypeScript, and Stripe 🔒💸
</h1>
</div>
</header>
{children}
</div>
<div className="banner">
<span>
This is a{' '}
<a
......@@ -47,17 +58,17 @@ const Layout: React.FunctionComponent<Props> = ({
>
Stripe Sample
</a>
.{' '}
.{' View code on '}
<a
href="https://github.com/zeit/next.js/tree/canary/examples/with-stripe-typescript"
target="_blank"
rel="noopener noreferrer"
>
View code on GitHub
GitHub
</a>
.
</span>
</footer>
</div>
</Elements>
)
......
......@@ -17,7 +17,7 @@
"next": "latest",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"stripe": "^8.8.1",
"stripe": "^8.15.0",
"swr": "^0.1.16"
},
"devDependencies": {
......
import { AppProps } from 'next/app'
import '../styles.css'
function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
export default MyApp
import { NextApiRequest, NextApiResponse } from 'next'
import Stripe from 'stripe'
const stripeSecretKey: string = process.env.STRIPE_SECRET_KEY!
const stripe = new Stripe(stripeSecretKey, {
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
// https://github.com/stripe/stripe-node#configuration
apiVersion: '2019-12-03',
typescript: true,
telemetry: true,
})
export default async (req: NextApiRequest, res: NextApiResponse) => {
......
......@@ -4,12 +4,9 @@ import { CURRENCY, MIN_AMOUNT, MAX_AMOUNT } from '../../../config'
import { formatAmountForStripe } from '../../../utils/stripe-helpers'
import Stripe from 'stripe'
const stripeSecretKey: string = process.env.STRIPE_SECRET_KEY!
const stripe = new Stripe(stripeSecretKey, {
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
// https://github.com/stripe/stripe-node#configuration
apiVersion: '2019-12-03',
typescript: true,
telemetry: true,
})
export default async (req: NextApiRequest, res: NextApiResponse) => {
......
......@@ -4,12 +4,9 @@ import { CURRENCY, MIN_AMOUNT, MAX_AMOUNT } from '../../../config'
import { formatAmountForStripe } from '../../../utils/stripe-helpers'
import Stripe from 'stripe'
const stripeSecretKey: string = process.env.STRIPE_SECRET_KEY!
const stripe = new Stripe(stripeSecretKey, {
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
// https://github.com/stripe/stripe-node#configuration
apiVersion: '2019-12-03',
typescript: true,
telemetry: true,
})
export default async (req: NextApiRequest, res: NextApiResponse) => {
......
......@@ -3,12 +3,9 @@ import Cors from 'micro-cors'
import { NextApiRequest, NextApiResponse } from 'next'
import Stripe from 'stripe'
const stripeSecretKey: string = process.env.STRIPE_SECRET_KEY!
const stripe = new Stripe(stripeSecretKey, {
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
// https://github.com/stripe/stripe-node#configuration
apiVersion: '2019-12-03',
typescript: true,
telemetry: true,
})
const webhookSecret: string = process.env.STRIPE_WEBHOOK_SECRET!
......@@ -45,18 +42,16 @@ const webhookHandler = async (req: NextApiRequest, res: NextApiResponse) => {
// Cast event data to Stripe object.
if (event.type === 'payment_intent.succeeded') {
const stripeObject: Stripe.PaymentIntent = event.data
.object as Stripe.PaymentIntent
console.log(`💰 PaymentIntent status: ${stripeObject.status}`)
} else if (event.type === 'charge.succeeded') {
const stripeObject = event.data.object as Stripe.Charge
console.log(`💵 Charge id: ${stripeObject.id}`)
const paymentIntent = event.data.object as Stripe.PaymentIntent
console.log(`💰 PaymentIntent status: ${paymentIntent.status}`)
} else if (event.type === 'payment_intent.payment_failed') {
const stripeObject: Stripe.PaymentIntent = event.data
.object as Stripe.PaymentIntent
const paymentIntent = event.data.object as Stripe.PaymentIntent
console.log(
`❌ Payment failed: ${stripeObject.last_payment_error?.message}`
`❌ Payment failed: ${paymentIntent.last_payment_error?.message}`
)
} else if (event.type === 'charge.succeeded') {
const charge = event.data.object as Stripe.Charge
console.log(`💵 Charge id: ${charge.id}`)
} else {
console.warn(`🤷‍♀️ Unhandled event type: ${event.type}`)
}
......
import { NextPage } from 'next'
import Link from 'next/link'
import Layout from '../components/Layout'
import CheckoutForm from '../components/CheckoutForm'
......@@ -7,14 +6,11 @@ import CheckoutForm from '../components/CheckoutForm'
const DonatePage: NextPage = () => {
return (
<Layout title="Donate with Checkout | Next.js + TypeScript Example">
<h1>Donate with Checkout</h1>
<p>Donate to our project 💖</p>
<CheckoutForm />
<p>
<Link href="/">
<a>Go home</a>
</Link>
</p>
<div className="page-container">
<h1>Donate with Checkout</h1>
<p>Donate to our project 💖</p>
<CheckoutForm />
</div>
</Layout>
)
}
......
import { NextPage } from 'next'
import Link from 'next/link'
import Layout from '../components/Layout'
import ElementsForm from '../components/ElementsForm'
......@@ -7,14 +6,11 @@ import ElementsForm from '../components/ElementsForm'
const DonatePage: NextPage = () => {
return (
<Layout title="Donate with Elements | Next.js + TypeScript Example">
<h1>Donate with Elements</h1>
<p>Donate to our project 💖</p>
<ElementsForm />
<p>
<Link href="/">
<a>Go home</a>
</Link>
</p>
<div className="page-container">
<h1>Donate with Elements</h1>
<p>Donate to our project 💖</p>
<ElementsForm />
</div>
</Layout>
)
}
......
......@@ -5,17 +5,24 @@ import Layout from '../components/Layout'
const IndexPage: NextPage = () => {
return (
<Layout title="Home | Next.js + TypeScript Example">
<h1>Type-safe Payments with Next.js, TypeScript, and Stripe 🔒💸</h1>
<p>
<Link href="/donate-with-checkout">
<a>Donate with Checkout</a>
</Link>
</p>
<p>
<Link href="/donate-with-elements">
<a>Donate with Elements</a>
</Link>
</p>
<ul className="card-list">
<li>
<Link href="/donate-with-checkout">
<a className="card checkout-style-background">
<h2 className="bottom">Donate with Checkout</h2>
<img src="/checkout-one-time-payments.svg" />
</a>
</Link>
</li>
<li>
<Link href="/donate-with-elements">
<a className="card elements-style-background">
<h2 className="bottom">Donate with Elements</h2>
<img src="/elements-card-payment.svg" />
</a>
</Link>
</li>
</ul>
</Layout>
)
}
......
import { NextPage } from 'next'
import { useRouter } from 'next/router'
import Link from 'next/link'
import Layout from '../components/Layout'
import PrintObject from '../components/PrintObject'
......@@ -23,18 +22,12 @@ const ResultPage: NextPage = () => {
return (
<Layout title="Checkout Payment Result | Next.js + TypeScript Example">
<h1>Checkout Payment Result</h1>
<h2>Status: {data?.payment_intent?.status ?? 'loading...'}</h2>
<p>
Your Checkout Session ID:{' '}
<code>{router.query.session_id ?? 'loading...'}</code>
</p>
<PrintObject content={data ?? 'loading...'} />
<p>
<Link href="/">
<a>Go home</a>
</Link>
</p>
<div className="page-container">
<h1>Checkout Payment Result</h1>
<h2>Status: {data?.payment_intent?.status ?? 'loading...'}</h2>
<h3>CheckoutSession response:</h3>
<PrintObject content={data ?? 'loading...'} />
</div>
</Layout>
)
}
......
<svg height="156" viewBox="0 0 240 156" width="240" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd" transform="translate(0 1)"><rect fill="#fff" height="154" opacity=".8" rx="4" width="240"/><path d="m99 0v154" opacity=".068034" stroke="#000" stroke-linecap="square"/><text style="opacity:.836844;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;font-size:18;font-weight:500;letter-spacing:-.45;fill:#8f6ed5"><tspan x="14" y="48">$29.90</tspan></text><path d="m18 17h23c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2h-23c-1.1045695 0-2-.8954305-2-2s.8954305-2 2-2z" fill="#8f6ed5"/><g transform="translate(112 109)"><path d="m3.58943928 0h109.02112172c1.248126 0 1.700727.12995586 2.157023.37398579s.8144.60213393 1.05843 1.05843023c.24403.45629629.373986.90889702.373986 2.15702326v12.42112142c0 1.2481263-.129956 1.700727-.373986 2.1570233s-.602134.8144003-1.05843 1.0584302-.908897.3739858-2.157023.3739858h-109.02112172c-1.24812624 0-1.70072697-.1299559-2.15702326-.3739858-.4562963-.2440299-.8144003-.6021339-1.05843023-1.0584302s-.37398579-.908897-.37398579-2.1570233v-12.42112142c0-1.24812624.12995586-1.70072697.37398579-2.15702326.24402993-.4562963.60213393-.8144003 1.05843023-1.05843023.45629629-.24402993.90889702-.37398579 2.15702326-.37398579z" fill="#8f6ed5"/><text style="opacity:.7;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;font-size:10;font-weight:500;letter-spacing:.12;fill:#f7fafc"><tspan x="29" y="14">Pay $29.90</tspan></text></g><g transform="translate(112 83)"><path d="m3.58943928.35c-1.08510563 0-1.53103464.08611287-1.99196366.33262041-.39530234.21141-.70344521.51955287-.91485521.91485521-.24650754.46092902-.33262041.90685803-.33262041 1.99196366v12.42112142c0 1.0851056.08611287 1.5310347.33262041 1.9919637.21141.3953023.51955287.7034452.91485521.9148552.46092902.2465075.90685803.3326204 1.99196366.3326204h109.02112172c1.085105 0 1.531034-.0861129 1.991963-.3326204.395303-.21141.703446-.5195529.914856-.9148552.246507-.460929.33262-.9068581.33262-1.9919637v-12.42112142c0-1.08510563-.086113-1.53103464-.33262-1.99196366-.21141-.39530234-.519553-.70344521-.914856-.91485521-.460929-.24650754-.906858-.33262041-1.991963-.33262041z" fill="#fff" opacity=".8" stroke="#8f6ed5" stroke-opacity=".266253" stroke-width=".7"/><g fill-rule="nonzero" opacity=".5" transform="translate(95.2 4.2)"><rect fill="#ebf1f8" height="10.7" rx="1.4" stroke="#a450b5" stroke-width=".5" width="16.3" x=".25" y=".25"/><path d="m2.30141283 4.14010612c-.36619921-.20085195-.7841356-.36238968-1.25141283-.47449094l.01960035-.08729771h1.91588511c.25968832.00910242.47040833.08723662.53897699.36318047l.41637443 1.98511543.12755149.59789495 1.1661881-2.94619085h1.2591758l-1.87173549 4.31595242h-1.25924092zm5.11856981 3.75874553h-1.1908025l.7448132-4.32053418h1.19073738zm4.31676486-4.21490945-.1619471.93296757-.1077042-.04587865c-.2154736-.0873588-.4999065-.17465651-.8870297-.16543191-.4701478 0-.68099808.18834069-.68588189.3722218 0 .20226923.25506499.33556776.67155609.53325523.6860773.30795505 1.0043062.6848197.9995526 1.17665586-.0096374.89631352-.8230844 1.47550848-2.07255766 1.47550848-.53422342-.00464284-1.04878137-.11057303-1.32807004-.22994303l.16663551-.96986596.15680278.06903178c.38712314.16103343.64186253.22982085 1.11728491.22982085.34284328 0 .7104312-.13342072.7151196-.42286548 0-.18846286-.1566074-.32646533-.61731322-.53789807-.45074287-.20691207-1.05340471-.55158225-1.04363709-1.17213519.00507916-.8410881.83317755-1.42938548 2.00913331-1.42938548.4606407 0 .8331775.09652231 1.0680561.1839422zm1.5826792 2.68429772h.989785c-.0489683-.21601449-.27447-1.2502083-.27447-1.2502083l-.0832201-.37228289c-.058801.16085015-.1616214.42286547-.1566725.41364087 0 0-.3773555.96064136-.4754224 1.20885032zm1.4698958-2.78992245.9606775 4.32047309h-1.1025684s-.1078996-.49641792-.1420862-.64810457h-1.5288922c-.0442148.11484934-.2499207.64810457-.2499207.64810457h-1.2494733l1.7687848-3.96199655c.122551-.28040343.3383502-.35847654.6223924-.35847654z" fill="#8f6ed5"/></g><g fill="#1a1f36" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" font-size="8.4" font-weight="500"><text opacity=".67"><tspan x="5.6" y="12.9">4242</tspan></text><text opacity=".67"><tspan x="33.6" y="12.9">11/26</tspan></text><text opacity=".67"><tspan x="61.6" y="12.9">934</tspan></text></g></g><g transform="translate(112 57)"><path d="m3.58943928.35c-1.08510563 0-1.53103464.08611287-1.99196366.33262041-.39530234.21141-.70344521.51955287-.91485521.91485521-.24650754.46092902-.33262041.90685803-.33262041 1.99196366v12.42112142c0 1.0851056.08611287 1.5310347.33262041 1.9919637.21141.3953023.51955287.7034452.91485521.9148552.46092902.2465075.90685803.3326204 1.99196366.3326204h109.02112172c1.085105 0 1.531034-.0861129 1.991963-.3326204.395303-.21141.703446-.5195529.914856-.9148552.246507-.460929.33262-.9068581.33262-1.9919637v-12.42112142c0-1.08510563-.086113-1.53103464-.33262-1.99196366-.21141-.39530234-.519553-.70344521-.914856-.91485521-.460929-.24650754-.906858-.33262041-1.991963-.33262041z" fill="#fff" opacity=".8" stroke="#8f6ed5" stroke-opacity=".266253" stroke-width=".7"/><text fill="#1a1f36" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" font-size="8.4" font-weight="500" opacity=".67"><tspan x="5.6" y="13.6">Jenny Rosen</tspan></text></g><g transform="translate(112 31)"><path d="m3.58943928.35c-1.08510563 0-1.53103464.08611287-1.99196366.33262041-.39530234.21141-.70344521.51955287-.91485521.91485521-.24650754.46092902-.33262041.90685803-.33262041 1.99196366v12.42112142c0 1.0851056.08611287 1.5310347.33262041 1.9919637.21141.3953023.51955287.7034452.91485521.9148552.46092902.2465075.90685803.3326204 1.99196366.3326204h109.02112172c1.085105 0 1.531034-.0861129 1.991963-.3326204.395303-.21141.703446-.5195529.914856-.9148552.246507-.460929.33262-.9068581.33262-1.9919637v-12.42112142c0-1.08510563-.086113-1.53103464-.33262-1.99196366-.21141-.39530234-.519553-.70344521-.914856-.91485521-.460929-.24650754-.906858-.33262041-1.991963-.33262041z" fill="#fff" opacity=".8" stroke="#8f6ed5" stroke-opacity=".266253" stroke-width=".7"/><text fill="#1a1f36" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" font-size="8.4" font-weight="500" opacity=".67"><tspan x="5.6" y="13.6">jenny@rosen.com</tspan></text></g></g></svg>
\ No newline at end of file
This diff is collapsed.
<svg height="64" viewBox="0 0 202 64" width="202" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><rect fill="#fff" height="28" opacity=".8" rx="4" width="202"/><g transform="translate(0 36)"><rect fill="#4e5663" height="28" rx="4" width="202"/><text style="opacity:.7;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;font-size:14;font-weight:500;letter-spacing:-.154;fill:#fff"><tspan x="63" y="19">Pay $29.90</tspan></text></g><text fill="#1a1f36" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" font-size="12" font-weight="500" opacity=".797503"><tspan x="9" y="19">4242 4242 4242 4242</tspan></text><g fill-rule="nonzero" opacity=".5" transform="translate(171 6)"><rect height="15.5" rx="2" stroke="#4f566b" stroke-width=".5" width="23.5" x=".25" y=".25"/><path d="m3.28773262 5.91443732c-.52314173-.28693137-1.12019372-.51769955-1.78773262-.6778442l.0280005-.12471102h2.73697872c.37098332.01300346.67201191.12462375.76996714.51882925l.59482061 2.83587917.18221641.85413565 1.66598301-4.20884407h1.79882257l-2.67390785 6.1656463h-1.79891559zm7.31224258 5.36963648h-1.70114643l1.06401886-6.1721917h1.70105337zm6.1668069-6.02129922-.2313529 1.3328108-.1538632-.06554092c-.3078194-.12479829-.7141522-.2495093-1.2671852-.2363313-.6716398 0-.9728545.26905813-.9798314.53174543 0 .28895604.3643786.47938251.9593659.76179318.9801104.43993579 1.4347231.97831385 1.4279323 1.68093694-.0137677 1.28044789-1.1758348 2.10786929-2.9607967 2.10786929-.7631763-.0066327-1.4982591-.1579615-1.8972429-.3284901l.2380507-1.38552277.224004.09861682c.5530331.23004776.9169465.32831555 1.5961213.32831555.4897761 0 1.0149017-.19060107 1.0215995-.60409358 0-.26923267-.2237249-.46637906-.8818761-.76842582-.6439184-.29558867-1.5048639-.78797464-1.4909101-1.67447884.0072559-1.20155443 1.1902536-2.04197926 2.8701904-2.04197926.6580581 0 1.1902536.13788902 1.5257944.26277458zm2.2609703 3.83471102h1.4139786c-.0699548-.30859213-.3921-1.78601186-.3921-1.78601186l-.1188858-.5318327c-.0840015.22978594-.2308878.60409353-.2238179.59091553 0 0-.5390794 1.3723448-.6791749 1.72692903zm2.0998512-3.9856035 1.3723964 6.1721044h-1.5750977s-.1541422-.7091684-.2029803-.9258637h-2.1841317c-.0631639.1640705-.3570296.9258637-.3570296.9258637h-1.7849619l2.5268355-5.65999506c.1750729-.40057632.4833574-.51210934.889132-.51210934z" fill="#3c4257"/></g></g></svg>
\ No newline at end of file
This diff is collapsed.
/* Variables */
:root {
--body-color: #fcfdfe;
--checkout-color: #8f6ed5;
--elements-color: #6772e5;
--body-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
sans-serif;
--h1-color: #1a1f36;
--h2-color: #7b818a;
--h3-color: #a3acb9;
--radius: 6px;
--container-width-max: 1280px;
--page-width-max: 600px;
--transition-duration: 2s;
}
body {
margin: 0;
padding: 0;
background: var(--body-color);
overflow-y: scroll;
}
* {
box-sizing: border-box;
font-family: var(--body-font-family);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
#__next {
display: flex;
justify-content: center;
}
.container {
max-width: var(--container-width-max);
padding: 45px 25px;
display: flex;
flex-direction: row;
}
.page-container {
padding-bottom: 60px;
max-width: var(--page-width-max);
}
h1 {
font-weight: 600;
color: var(--h1-color);
margin: 6px 0 12px;
font-size: 27px;
line-height: 32px;
}
h1 span.light {
color: var(--h3-color);
}
h2 {
color: var(--h2-color);
margin: 8px 0;
}
h3 {
font-size: 17px;
color: var(--h3-color);
margin: 8px 0;
}
a {
color: var(--checkout-color);
text-decoration: none;
}
header {
position: relative;
flex: 0 0 250px;
padding-right: 48px;
}
.header-content {
position: sticky;
top: 45px;
}
.logo img {
height: 20px;
margin-bottom: 52px;
}
ul,
li {
list-style: none;
padding: 0;
margin: 0;
}
.card-list {
display: flex;
flex-wrap: wrap;
align-content: flex-start;
padding-top: 64px;
}
.card {
display: block;
border-radius: 10px;
position: relative;
padding: 12px;
height: 320px;
flex: 0 0 33%;
min-width: 304px;
width: 33%;
margin: 0 20px 0 0;
text-decoration: none;
box-shadow: -20px 20px 60px #abacad, 20px -20px 60px #ffffff;
}
.card h2 {
color: #fff;
}
.card h2.bottom {
position: absolute;
bottom: 10px;
}
.card img {
width: 80%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.error-message {
color: #ef2961;
}
.FormRow,
fieldset,
input[type='number'],
input[type='text'] {
border-radius: var(--radius);
padding: 5px 12px;
width: 100%;
background: #fff;
appearance: none;
font-size: 16px;
margin-top: 10px;
}
input[type='range'] {
margin: 5px 0;
width: 100%;
}
button {
border-radius: var(--radius);
color: white;
font-size: larger;
border: 0;
padding: 12px 16px;
margin-top: 10px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
display: block;
width: 100%;
}
.elements-style {
color: var(--elements-color);
border: 1px solid var(--elements-color);
}
.elements-style-background {
background: var(--elements-color);
transition: box-shadow var(--transition-duration);
}
.card.elements-style-background:hover {
box-shadow: 20px 20px 60px #464e9c, -20px -20px 60px #8896ff;
}
.checkout-style {
color: var(--checkout-color);
border: 1px solid var(--checkout-color);
}
.checkout-style-background {
background: var(--checkout-color);
transition: box-shadow var(--transition-duration);
}
.card.checkout-style-background:hover {
box-shadow: 20px 20px 60px #614b91, -20px -20px 60px #bd91ff;
}
/* Code block */
code,
pre {
font-family: 'SF Mono', 'IBM Plex Mono', 'Menlo', monospace;
font-size: 12px;
background: rgba(0, 0, 0, 0.03);
padding: 12px;
border-radius: var(--radius);
max-height: 500px;
width: var(--page-width-max);
overflow: auto;
}
.banner {
max-width: 825px;
margin: 0 auto;
font-size: 14px;
background: var(--body-color);
color: #6a7c94;
border-radius: 50px;
box-shadow: -20px 20px 60px #abacad, 20px -20px 60px #ffffff;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 15px;
line-height: 1.15;
position: fixed;
bottom: 2vh;
left: 0;
right: 0;
text-align: center;
justify-content: center;
}
@media only screen and (max-width: 980px) {
.container {
flex-direction: column;
}
.header-content {
max-width: 280px;
position: relative;
top: 0;
}
.card {
margin: 0 20px 20px 0;
box-shadow: none;
}
.card-list {
padding-top: 0;
}
.banner {
box-shadow: none;
bottom: 0;
}
}
@media only screen and (max-width: 600px) {
.container {
flex-direction: column;
}
.card {
display: block;
border-radius: 8px;
flex: 1 0 100%;
max-width: 100%;
padding-left: 0;
padding-right: 0;
margin: 0 0 20px 0;
box-shadow: none;
}
.card-list {
padding-top: 0;
}
code,
pre,
h3 {
display: none;
}
.banner {
box-shadow: none;
bottom: 0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment