@@ -4,9 +4,23 @@ import TeamSection from '../components/TeamSection';
4
4
import FeaturesSection from '../components/FeaturesSection' ;
5
5
import Image from 'next/image' ;
6
6
import Blogs from './Blogs' ;
7
+ import { useState } from 'react' ;
8
+ import { trpc } from '../../utils/trpc' ;
9
+
10
+ export default function LandingPage ( ) : JSX . Element {
11
+ const [ name , setName ] = useState ( '' ) ;
12
+ const [ email , setEmail ] = useState ( '' ) ;
13
+
14
+ const handleSubmit = ( e : React . MouseEvent < HTMLButtonElement , MouseEvent > ) => {
15
+ e . preventDefault ( ) ;
16
+ // grab the information of name and email
17
+ // bundle those together to be an object to be sent to backend
18
+ const { mutate } = trpc . user . createUser . useMutation ( ) ;
19
+ mutate ( { name, email} ) ;
20
+ }
7
21
8
- export default function LandingPage ( ) :any {
9
22
return (
23
+ < >
10
24
< div className = "bg-gray-50" >
11
25
< main >
12
26
{ /* Hero section */ }
@@ -42,6 +56,18 @@ export default function LandingPage():any {
42
56
</ div >
43
57
< form action = "#" className = "mt-12 sm:flex sm:w-full sm:max-w-lg" >
44
58
< div className = "min-w-0 flex-1" >
59
+ < label htmlFor = "name" className = "sr-only" >
60
+ Name
61
+ </ label >
62
+ < input
63
+ id = "name"
64
+ type = "text"
65
+ className = "block w-full rounded-md border border-gray-300 px-5 mb-2 py-3 text-base text-gray-900 placeholder-gray-500 shadow-sm focus:border-rose-500 focus:ring-rose-500"
66
+ placeholder = "Enter your name"
67
+ required
68
+ value = { name }
69
+ onChange = { ( e ) => { setName ( e . target . value ) } }
70
+ />
45
71
< label htmlFor = "hero-email" className = "sr-only" >
46
72
Email address
47
73
</ label >
@@ -50,12 +76,16 @@ export default function LandingPage():any {
50
76
type = "email"
51
77
className = "block w-full rounded-md border border-gray-300 px-5 py-3 text-base text-gray-900 placeholder-gray-500 shadow-sm focus:border-rose-500 focus:ring-rose-500"
52
78
placeholder = "Enter your email"
79
+ required
80
+ value = { email }
81
+ onChange = { ( e ) => { setEmail ( e . target . value ) } }
53
82
/>
54
83
</ div >
55
84
< div className = "mt-4 sm:mt-0 sm:ml-3" >
56
85
< button
57
86
type = "submit"
58
- className = "block w-full rounded-md border border-transparent bg-rose-500 px-5 py-3 text-base font-medium text-white shadow hover:bg-rose-600 focus:outline-none focus:ring-2 focus:ring-rose-500 focus:ring-offset-2 sm:px-10"
87
+ className = "block w-full rounded-md border border-transparent bg-rose-500 mt-8 px-5 py-3 text-base font-medium text-white shadow hover:bg-rose-600 focus:outline-none focus:ring-2 focus:ring-rose-500 focus:ring-offset-2 sm:px-10"
88
+ onClick = { ( e ) => handleSubmit ( e ) }
59
89
>
60
90
Notify me
61
91
</ button >
@@ -130,5 +160,6 @@ export default function LandingPage():any {
130
160
</ div >
131
161
</ footer >
132
162
</ div >
163
+ </ >
133
164
)
134
165
}
0 commit comments