19 May 2024
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
@tailwind base;
@tailwind components;
@tailwind utilities;
import { useState } from 'react';
import 'animate.css';
const App = ()=>{
const model = {
firstname: '',
lastname: '',
email: '',
password: '',
username: '',
mobile: ''
}
const [form, setForm] = useState(model)
const getFormValue = (e)=>{
const input = e.target
const value = input.value
const key = input.name
setForm({
...form,
[key]: value
})
}
const signup = (e)=>{
e.preventDefault()
console.log(form)
}
return (
<div className="bg-gray-100 h-screen flex justify-center items-center">
<div className="bg-white px-8 py-6 w-[450px] shadow-lg rounded-lg animate__animated animate__zoomIn">
<h1 className='text-2xl font-bold mb-4 text-center'>CodingOtt Signup Form</h1>
<form className='flex flex-col gap-4' onSubmit={signup}>
<div className='flex flex-col gap-1'>
<label className='text-lg font-semibold'>Firstname</label>
<input
name="firstname"
type="text"
placeholder="Enter first name here"
className='border p-2 rounded border-gray-300'
onChange={getFormValue}
/>
{/* <small className='text-rose-600 font-semibold text-sm'>This field is required</small> */}
</div>
<div className='flex flex-col gap-1'>
<label className='text-lg font-semibold'>Lastname</label>
<input
name="lastname"
type="text"
placeholder="Enter last name here"
className='border p-2 rounded border-gray-300'
onChange={getFormValue}
/>
{/* <small className='text-rose-600 font-semibold text-sm'>This field is required</small> */}
</div>
<div className='flex flex-col gap-2'>
<label className='text-lg font-semibold'>Email</label>
<input
name="email"
type="email"
placeholder="email@gmail.com"
className='border p-2 rounded border-gray-300'
onChange={getFormValue}
/>
{/* <small className='text-rose-600 font-semibold text-sm'>This field is required</small> */}
</div>
<div className='flex flex-col gap-2'>
<label className='text-lg font-semibold'>Password</label>
<input
name="password"
type="password"
placeholder="*************"
className='border p-2 rounded border-gray-300'
onChange={getFormValue}
/>
{/* <small className='text-rose-600 font-semibold text-sm'>This field is required</small> */}
</div>
<div className='flex flex-col gap-2'>
<label className='text-lg font-semibold'>Username</label>
<input
name="username"
type="text"
placeholder="@Username"
className='border p-2 rounded border-gray-300'
onChange={getFormValue}
/>
{/* <small className='text-rose-600 font-semibold text-sm'>This field is required</small> */}
</div>
<div className='flex flex-col gap-2'>
<label className='text-lg font-semibold'>Mobile no</label>
<input
name="mobile"
type="number"
placeholder="9472395194"
className='border p-2 rounded border-gray-300'
onChange={getFormValue}
/>
{/* <small className='text-rose-600 font-semibold text-sm'>This field is required</small> */}
</div>
<button className='border-0 bg-indigo-600 text-white rounded py-2 font-semibold'>Submit</button>
</form>
</div>
</div>
)
}
export default App