Skip to content

Commit

Permalink
Turn 'back' link into a button
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNeshi committed Jan 12, 2024
1 parent 05c9dfb commit 3c11011
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions src/components/donation/Steps/DonateMethods/Stripe/Checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import {
} from "@stripe/react-stripe-js";
import { FormEventHandler, useState } from "react";
import { useErrorContext } from "contexts/ErrorContext";
import Icon from "components/Icon";
import LoadText from "components/LoadText";
import LoaderRing from "components/LoaderRing";
import { GENERIC_ERROR_MESSAGE } from "constants/common";
import { appRoutes } from "constants/routes";

Expand Down Expand Up @@ -53,15 +51,7 @@ export default function Checkout({ onBack }: { onBack: () => void }) {
};

return (
<form onSubmit={handleSubmit} className="grid gap-4">
<button
type="button"
onClick={onBack}
className="text-blue underline hover:text-orange flex items-center gap-1 mb-2"
>
<Icon type="Back" />
<span>Back</span>
</button>
<form onSubmit={handleSubmit} className="grid gap-8">
<PaymentElement
options={{ layout: "tabs" }}
onReady={() => setLoading(false)}
Expand All @@ -71,17 +61,32 @@ export default function Checkout({ onBack }: { onBack: () => void }) {
}}
/>
{isLoading ? (
<LoaderRing thickness={10} classes="w-12 justify-self-center" />
) : (
<button
className="btn-orange btn-donate w-1/2 justify-self-center"
disabled={!stripe || !elements}
type="submit"
className="btn-outline-filled btn-donate w-1/2"
onClick={onBack}
type="button"
>
<LoadText text="Processing..." isLoading={isLoading}>
Pay Now
</LoadText>
Back
</button>
) : (
<div className="grid grid-cols-2 gap-5 w-full">
<button
className="btn-outline-filled btn-donate"
onClick={onBack}
type="button"
>
Back
</button>
<button
className="btn-orange btn-donate"
disabled={!stripe || !elements}
type="submit"
>
<LoadText text="Processing..." isLoading={isLoading}>
Pay Now
</LoadText>
</button>
</div>
)}
</form>
);
Expand Down

0 comments on commit 3c11011

Please sign in to comment.