@@ -4,9 +4,23 @@ import TeamSection from '../components/TeamSection';
44import FeaturesSection from '../components/FeaturesSection' ;
55import Image from 'next/image' ;
66import 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+ }
721
8- export default function LandingPage ( ) :any {
922 return (
23+ < >
1024 < div className = "bg-gray-50" >
1125 < main >
1226 { /* Hero section */ }
@@ -42,6 +56,18 @@ export default function LandingPage():any {
4256 </ div >
4357 < form action = "#" className = "mt-12 sm:flex sm:w-full sm:max-w-lg" >
4458 < 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+ />
4571 < label htmlFor = "hero-email" className = "sr-only" >
4672 Email address
4773 </ label >
@@ -50,12 +76,16 @@ export default function LandingPage():any {
5076 type = "email"
5177 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"
5278 placeholder = "Enter your email"
79+ required
80+ value = { email }
81+ onChange = { ( e ) => { setEmail ( e . target . value ) } }
5382 />
5483 </ div >
5584 < div className = "mt-4 sm:mt-0 sm:ml-3" >
5685 < button
5786 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 ) }
5989 >
6090 Notify me
6191 </ button >
@@ -130,5 +160,6 @@ export default function LandingPage():any {
130160 </ div >
131161 </ footer >
132162 </ div >
163+ </ >
133164 )
134165}
0 commit comments