You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
spa_instat_tv/src/features/StripeElements/index.tsx

30 lines
659 B

import type { ReactNode } from 'react'
import { Elements } from '@stripe/react-stripe-js'
import { loadStripe, StripeElementLocale } from '@stripe/stripe-js'
import { STRIPE_PUBLIC_KEY } from 'config/env'
import { useLexicsStore } from 'features/LexicsStore'
type Props = {
children: ReactNode,
}
export const StripeElements = ({ children }: Props) => {
const { lang } = useLexicsStore()
const stripe = loadStripe(STRIPE_PUBLIC_KEY, {
locale: lang as StripeElementLocale,
})
return (
<Elements
key={lang}
stripe={stripe}
options={{ locale: lang as StripeElementLocale }}
>
{children}
</Elements>
)
}