1
- import { Link } from "@remix-run/react" ;
1
+ import { useNavigate } from "@remix-run/react" ;
2
+ import { Modal } from "components/modal" ;
2
3
import { Video , videos } from "components/video/video" ;
4
+ import { useState } from "react" ;
5
+ import { useHubspotForm } from "./use-hubspot-form" ;
3
6
4
7
export function Top ( { classes = "" } ) {
8
+ const navigate = useNavigate ( ) ;
9
+ const { state } = useHubspotForm ( ) ;
10
+ const [ open , setOpen ] = useState ( false ) ;
11
+
5
12
return (
6
13
< section
7
14
className = { `${ classes } grid grid-cols-1 lg:grid-cols-2 gap-12 p-4 @container` }
@@ -31,6 +38,21 @@ export function Top({ classes = "" }) {
31
38
investing, and no platform fees — all set up in just minutes.
32
39
</ p >
33
40
41
+ { open && (
42
+ < Modal
43
+ classes = "fixed-center z-10 grid text-gray-d4 bg-white sm:w-full w-[90vw] sm:max-w-lg rounded-sm overflow-hidden"
44
+ open = { open }
45
+ onClose = { ( ) => setOpen ( false ) }
46
+ >
47
+ < div
48
+ className = "hs-form-frame"
49
+ data-region = "eu1"
50
+ data-form-id = "17bb2a2b-322c-4a8c-b8d6-50bb1a59881c"
51
+ data-portal-id = "24900163"
52
+ />
53
+ </ Modal >
54
+ ) }
55
+
34
56
< div className = "grid @md:grid-cols-2 gap-6 mb-6" >
35
57
< p className = "max-lg:border-t-1 max-lg:pt-2 lg:border-r-4 max-lg:text-center text-right border-blue pr-4" >
36
58
80% of donors cover fees* — keep more of every gift
@@ -46,12 +68,18 @@ export function Top({ classes = "" }) {
46
68
</ p >
47
69
</ div >
48
70
49
- < Link
50
- to = "/donation-calculator"
71
+ < button
72
+ onClick = { ( ) => {
73
+ if ( state !== "loaded" ) {
74
+ return navigate ( "/donation-calculator" ) ;
75
+ }
76
+ setOpen ( true ) ;
77
+ } }
78
+ type = "button"
51
79
className = "mt-4 btn btn-blue text-center lg:text-right lg:justify-self-end normal-case rounded-lg py-4 px-8 w-full md:w-auto"
52
80
>
53
81
See Your Savings - Launch the Calculator
54
- </ Link >
82
+ </ button >
55
83
56
84
< p className = "max-lg:text-center text-right text-sm text-gray mt-2" >
57
85
"It takes less than a minute — find out how much you're leaving on the
0 commit comments