File tree 2 files changed +14
-52
lines changed
2 files changed +14
-52
lines changed Original file line number Diff line number Diff line change @@ -4,21 +4,28 @@ import CheckmarkCircleIcon from "./icons/CheckmarkCircleIcon.js";
4
4
import MailCircleIcon from "./icons/MailCircleIcon.js" ;
5
5
import PointerCircleIcon from "./icons/PointerCircleIcon.js" ;
6
6
import { useI18n } from "../lib/i18n" ;
7
+
7
8
const newsletterFormEndpoint =
8
9
"https://geops.us4.list-manage.com/subscribe/post?u=23161055bb6a407f7e6c00038&id=c9694280f7" ;
10
+
9
11
export default function NewsletterForm ( { translations } ) {
10
12
const refHeader = createRef ( ) ;
11
13
const [ submitted , setSubmitted ] = useState ( false ) ;
12
14
const { language } = useI18n ( ) ;
13
- const handleSubmit = ( event ) => {
14
- const body = new FormData ( event . target ) ;
15
+
16
+ const handleSubmit = async ( event ) => {
15
17
event . preventDefault ( ) ;
16
18
refHeader . current . scrollIntoView ( { behavior : "smooth" } ) ;
17
19
try {
18
- fetch ( newsletterFormEndpoint , { method : "POST" , body } ) ;
20
+ await fetch ( newsletterFormEndpoint , {
21
+ body : new FormData ( event . target ) ,
22
+ method : "POST" ,
23
+ mode : "no-cors" ,
24
+ } ) ;
25
+ setSubmitted ( true ) ;
19
26
} catch ( error ) { }
20
- setSubmitted ( true ) ;
21
27
} ;
28
+
22
29
return (
23
30
< form
24
31
className = "container mx-auto max-w-screen-lg p-8"
Original file line number Diff line number Diff line change
1
+ import Teaser from "./Teaser" ;
1
2
import { useI18n } from "../lib/i18n" ;
2
- import useIntersectionOberserver from "../lib/useIntersectionOberserver" ;
3
-
4
- const buttonClassName =
5
- "bg-green py-4 px-14 text-white font-bold rounded inline-block hover:bg-green-light transition duration-300 ease-in-out" ;
6
-
7
- // Workaround to link to external newsletter page
8
- // TODO: fix signup on our own /newsletter page
9
- function CustomTeaser ( props ) {
10
- const contentRef = useIntersectionOberserver ( "opacity-0" , 0.2 ) ;
11
- let teaserTitle = "" ;
12
-
13
- if ( props . toHeading ) {
14
- teaserTitle = `<h1 class="break-words w-full">${ props . title } </h1>` ;
15
- } else {
16
- teaserTitle = `<h2 class="break-words w-full text-5xl">${ props . title } </h2>` ;
17
- }
18
-
19
- return (
20
- < section className = { props . containerClassName || "bg-white" } >
21
- < div
22
- className = "container mx-auto px-8 py-16 md:py-24 text-center flex flex-col items-center transform transition-opacity duration-1000"
23
- ref = { contentRef }
24
- >
25
- < div
26
- className = "mb-7"
27
- dangerouslySetInnerHTML = { { __html : teaserTitle } }
28
- > </ div >
29
- { props . subtitle && (
30
- < h3
31
- className = { `mb-16 max-w-md text-2xl ${
32
- props . subtitleClassName || ""
33
- } `}
34
- >
35
- { props . subtitle }
36
- </ h3 >
37
- ) }
38
- { props . text && (
39
- < p className = "mb-16 md:px-16 lg:px-32 text-left" > { props . text } </ p >
40
- ) }
41
- < a className = { buttonClassName } href = { props . href } target = "newsletter" >
42
- { props . action }
43
- </ a >
44
- </ div >
45
- </ section >
46
- ) ;
47
- }
48
3
49
4
export default function NewsletterTeaser ( ) {
50
5
const { t } = useI18n ( ) ;
51
6
return (
52
- < CustomTeaser
7
+ < Teaser
53
8
title = { t ( "newsletterTeaser.title" ) }
54
9
subtitle = { t ( "newsletterTeaser.subtitle" ) }
55
10
action = { t ( "newsletterTeaser.action" ) }
56
- href = "http://geops.sh/geopsnews "
11
+ href = "/newsletter "
57
12
/>
58
13
) ;
59
14
}
You can’t perform that action at this time.
0 commit comments