@@ -3,7 +3,7 @@ import { useState, useEffect } from "preact/hooks"
33import MailchimpSubscribe from "react-mailchimp-subscribe"
44import SubscribeSvg from "~/assets/svgs/footer/subscribe.svg?react"
55import { clsx } from "~/lib"
6- import i18next , { changeLanguage , t } from "i18next"
6+ import i18next , { t } from "i18next"
77
88import EmailInput from "./EmailInput.tsx"
99import styles from "./Subscribe.module.css"
@@ -19,14 +19,9 @@ export default function Subscribe(props) {
1919 const [ email , setEmail ] = useState ( "" )
2020 const [ customMessage , setCustomMessage ] = useState ( "" )
2121 const [ emailValid , setEmailValid ] = useState ( false )
22- const [ key , setKey ] = useState ( 0 )
23-
24- i18next . changeLanguage ( props . lang )
2522
2623 useEffect ( ( ) => {
27- setTimeout ( ( ) => {
28- setKey ( key + 1 )
29- } , 300 )
24+ i18next . changeLanguage ( props . lang )
3025 } , [ props . lang ] )
3126
3227 useEffect ( ( ) => {
@@ -50,16 +45,16 @@ export default function Subscribe(props) {
5045 }
5146
5247 return (
53- < div key = { key } className = { clsx ( styles . container , "dark:bg-dark-highlight" ) } >
48+ < div key = { props . lang } className = { clsx ( styles . container , "dark:bg-dark-highlight" ) } >
5449 < div className = { styles . subscribeBox } >
5550 < span className = "text-white dark:text-black bg-black dark:bg-white rounded-[50%]" >
5651 < SubscribeSvg > </ SubscribeSvg >
5752 </ span >
5853
5954 < div className = { styles . copyBox } >
60- < div className = { styles . subscribeTitle } > { t ( "landing.NewsletterCTA.title" ) } </ div >
55+ < div className = { styles . subscribeTitle } > { t ( "landing.NewsletterCTA.title" ) } </ div >
6156 < div className = { styles . subscribeText } >
62- { t ( "landing.NewsletterCTA.text" ) }
57+ { t ( "landing.NewsletterCTA.text" ) }
6358 </ div >
6459 </ div >
6560 < MailchimpSubscribe
@@ -72,7 +67,7 @@ export default function Subscribe(props) {
7267 onChange = { handleChangeEmail }
7368 onClick = { ( ) => handleSubmit ( subscribe ) }
7469 onEnter = { ( ) => handleSubmit ( subscribe ) }
75- placeholder = { t ( "landing.NewsletterCTA.placeholder" ) }
70+ placeholder = { t ( "landing.NewsletterCTA.placeholder" ) }
7671 end = { status === "success" }
7772 />
7873 { customMessage && < div className = { styles . errorMessage } > { customMessage } </ div > }
0 commit comments