@@ -13,8 +13,8 @@ import { useStripePromise } from "./use-stripe-promise";
13
13
import { LoadingButton } from "@podkit/buttons/LoadingButton" ;
14
14
import { useMutation } from "@tanstack/react-query" ;
15
15
import { useStripeAppearance } from "./use-stripe-appearance" ;
16
- import DropDown from "../DropDown " ;
17
- import { useCurrency } from "../../payment-context" ;
16
+ import { Select , SelectContent , SelectItem , SelectTrigger , SelectValue } from "@podkit/select/Select " ;
17
+ import { Currency , useCurrency } from "../../payment-context" ;
18
18
import Alert from "../Alert" ;
19
19
20
20
type Props = {
@@ -58,6 +58,8 @@ function AddPaymentMethodForm({ attributionId }: { attributionId: string }) {
58
58
const elements = useElements ( ) ;
59
59
const { currency, setCurrency } = useCurrency ( ) ;
60
60
61
+ const currencySymbol = currency === "EUR" ? "€" : "$" ;
62
+
61
63
const confirmPayment = useMutation ( async ( ) => {
62
64
const attrId = AttributionId . parse ( attributionId ) ;
63
65
if ( ! stripe || ! elements || ! attrId ) {
@@ -80,7 +82,7 @@ function AddPaymentMethodForm({ attributionId }: { attributionId: string }) {
80
82
}
81
83
} catch ( error ) {
82
84
console . error ( "Unable to confirm payment method." , error ) ;
83
- let message = error ?. message || String ( error ) || "Unable to confirm your payment method." ;
85
+ const message = error ?. message || String ( error ) || "Unable to confirm your payment method." ;
84
86
throw new Error ( message ) ;
85
87
}
86
88
} ) ;
@@ -94,11 +96,14 @@ function AddPaymentMethodForm({ attributionId }: { attributionId: string }) {
94
96
) ;
95
97
96
98
return (
97
- < form onSubmit = { handleSubmit } >
99
+ < form
100
+ onSubmit = { handleSubmit }
101
+ className = "flex flex-col max-h-[calc(100dvh-3rem)] min-[576px]:max-h-[calc(100dvh-6rem)] overflow-hidden"
102
+ >
98
103
< ModalBody >
99
104
< Alert type = "message" className = "mb-4" >
100
- This card will be used for future charges. We'll be placing a 1.00 hold on it that we'll immediately
101
- release in order to verify your payment method.
105
+ This card will be used for future charges. We'll be placing a { currencySymbol } 1.00 hold on it that
106
+ we'll immediately release in order to verify your payment method.
102
107
</ Alert >
103
108
< PaymentElement id = "payment-element" />
104
109
< AddressElement id = "address-element" options = { { mode : "billing" , display : { name : "organization" } } } />
@@ -115,21 +120,20 @@ function AddPaymentMethodForm({ attributionId }: { attributionId: string }) {
115
120
>
116
121
< div className = "flex items-center space-x-1" >
117
122
< span > Currency:</ span >
118
- < DropDown
119
- customClasses = "w-32"
120
- renderAsLink = { true }
121
- activeEntry = { currency }
122
- entries = { [
123
- {
124
- title : "EUR" ,
125
- onClick : ( ) => setCurrency ( "EUR" ) ,
126
- } ,
127
- {
128
- title : "USD" ,
129
- onClick : ( ) => setCurrency ( "USD" ) ,
130
- } ,
131
- ] }
132
- />
123
+ < Select
124
+ value = { currency }
125
+ onValueChange = { ( currency ) => {
126
+ setCurrency ( currency as Currency ) ;
127
+ } }
128
+ >
129
+ < SelectTrigger className = "w-24" >
130
+ < SelectValue placeholder = "Currency" />
131
+ </ SelectTrigger >
132
+ < SelectContent >
133
+ < SelectItem value = "EUR" > EUR</ SelectItem >
134
+ < SelectItem value = "USD" > USD</ SelectItem >
135
+ </ SelectContent >
136
+ </ Select >
133
137
</ div >
134
138
< LoadingButton type = "submit" disabled = { ! stripe } loading = { confirmPayment . isLoading } >
135
139
Confirm
0 commit comments