Compare commits
2 commits
7f0488c75e
...
15f0ee7f5e
Author | SHA1 | Date | |
---|---|---|---|
|
15f0ee7f5e | ||
|
170dad18f0 |
|
@ -1,2 +1,8 @@
|
||||||
# Assignment5
|
# React + Vite
|
||||||
|
|
||||||
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||||
|
|
||||||
|
Currently, two official plugins are available:
|
||||||
|
|
||||||
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
||||||
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
||||||
|
|
38
eslint.config.js
Normal file
38
eslint.config.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import js from '@eslint/js'
|
||||||
|
import globals from 'globals'
|
||||||
|
import react from 'eslint-plugin-react'
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{ ignores: ['dist'] },
|
||||||
|
{
|
||||||
|
files: ['**/*.{js,jsx}'],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
globals: globals.browser,
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
ecmaFeatures: { jsx: true },
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings: { react: { version: '18.3' } },
|
||||||
|
plugins: {
|
||||||
|
react,
|
||||||
|
'react-hooks': reactHooks,
|
||||||
|
'react-refresh': reactRefresh,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...js.configs.recommended.rules,
|
||||||
|
...react.configs.recommended.rules,
|
||||||
|
...react.configs['jsx-runtime'].rules,
|
||||||
|
...reactHooks.configs.recommended.rules,
|
||||||
|
'react/jsx-no-target-blank': 'off',
|
||||||
|
'react-refresh/only-export-components': [
|
||||||
|
'warn',
|
||||||
|
{ allowConstantExport: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
13
index.html
Normal file
13
index.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Vite + React</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.jsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
4656
package-lock.json
generated
Normal file
4656
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
29
package.json
Normal file
29
package.json
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"name": "assignment5",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"react": "^18.3.1",
|
||||||
|
"react-dom": "^18.3.1",
|
||||||
|
"react-router-dom": "^7.1.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.17.0",
|
||||||
|
"@types/react": "^18.3.18",
|
||||||
|
"@types/react-dom": "^18.3.5",
|
||||||
|
"@vitejs/plugin-react": "^4.3.4",
|
||||||
|
"eslint": "^9.17.0",
|
||||||
|
"eslint-plugin-react": "^7.37.2",
|
||||||
|
"eslint-plugin-react-hooks": "^5.0.0",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.16",
|
||||||
|
"globals": "^15.14.0",
|
||||||
|
"vite": "^6.0.5"
|
||||||
|
}
|
||||||
|
}
|
1
public/vite.svg
Normal file
1
public/vite.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
After Width: | Height: | Size: 1.5 KiB |
8
src/App.jsx
Normal file
8
src/App.jsx
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import React from "react";
|
||||||
|
import UserInfo from "./UserInfo";
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
return <UserInfo />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
14
src/UserInfo/LandingPage.jsx
Normal file
14
src/UserInfo/LandingPage.jsx
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
function LandingPage({setSteps })
|
||||||
|
{
|
||||||
|
|
||||||
|
function goto()
|
||||||
|
{
|
||||||
|
setSteps(1)
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<button type="button" onClick={goto}>Go To</button>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default LandingPage;
|
120
src/UserInfo/components/Personal/PersonalDetail.jsx
Normal file
120
src/UserInfo/components/Personal/PersonalDetail.jsx
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
function PersonalDetail({ setSteps, setPersonalDetail, personaldetail }) {
|
||||||
|
const [formErrors, setFormErrors] = useState({});
|
||||||
|
let name, value;
|
||||||
|
const handleInputs = (e) => {
|
||||||
|
name = e.target.name;
|
||||||
|
value = e.target.value;
|
||||||
|
setPersonalDetail({ ...personaldetail, [name]: value });
|
||||||
|
setFormErrors((prevState) => ({
|
||||||
|
...prevState,
|
||||||
|
[name]: "",
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
const validate = (personaldetail) => {
|
||||||
|
const errors = {};
|
||||||
|
const regex = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/i;
|
||||||
|
if (!personaldetail.name) {
|
||||||
|
errors.name = "* Valid name is required!";
|
||||||
|
}
|
||||||
|
if (!personaldetail.email || !regex.test(personaldetail.email)) {
|
||||||
|
errors.email = "* Valid email is required";
|
||||||
|
}
|
||||||
|
if (!personaldetail.phone || personaldetail.phone.length !== 10) {
|
||||||
|
errors.phone = "* Phone number must be 10 digits only";
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!personaldetail.age ||
|
||||||
|
personaldetail.age < 18 ||
|
||||||
|
personaldetail.age > 100
|
||||||
|
) {
|
||||||
|
errors.age = "* Enter age between 18 and 100";
|
||||||
|
}
|
||||||
|
if (!personaldetail.gender) {
|
||||||
|
errors.gender = "* Gender is required";
|
||||||
|
}
|
||||||
|
return errors;
|
||||||
|
};
|
||||||
|
|
||||||
|
const nextPage = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const errors = validate(personaldetail);
|
||||||
|
setFormErrors(errors);
|
||||||
|
|
||||||
|
if (Object.keys(errors).length === 0) setSteps(2);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="page" id="personal-detail">
|
||||||
|
<div className="page-container" id="personal-detail-container">
|
||||||
|
<h2>Personal Details</h2>
|
||||||
|
|
||||||
|
<input
|
||||||
|
htmlFor="name"
|
||||||
|
type="text"
|
||||||
|
required
|
||||||
|
placeholder="Enter your name"
|
||||||
|
name="name"
|
||||||
|
value={personaldetail.name}
|
||||||
|
onChange={handleInputs}
|
||||||
|
/>
|
||||||
|
<p className="error-msg">{formErrors.name}</p>
|
||||||
|
|
||||||
|
<input
|
||||||
|
htmlFor="email"
|
||||||
|
type="mail"
|
||||||
|
placeholder="Enter your email"
|
||||||
|
name="email"
|
||||||
|
value={personaldetail.email}
|
||||||
|
onChange={handleInputs}
|
||||||
|
/>
|
||||||
|
<p className="error-msg">{formErrors.email}</p>
|
||||||
|
<input
|
||||||
|
htmlFor="phone"
|
||||||
|
name="phone"
|
||||||
|
type="tel"
|
||||||
|
maxLength={10}
|
||||||
|
minLength={10}
|
||||||
|
placeholder="Mob no."
|
||||||
|
value={personaldetail.phone}
|
||||||
|
onChange={handleInputs}
|
||||||
|
/>
|
||||||
|
<p className="error-msg">{formErrors.phone}</p>
|
||||||
|
<p>
|
||||||
|
Select your Gender
|
||||||
|
<select
|
||||||
|
htmlFor="gender"
|
||||||
|
name="gender"
|
||||||
|
id=""
|
||||||
|
value={personaldetail.gender}
|
||||||
|
onChange={handleInputs}
|
||||||
|
>
|
||||||
|
<option value="Other">Other</option>
|
||||||
|
<option value="Male">Male</option>
|
||||||
|
<option value="Female">Female</option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
<p className="error-msg">{formErrors.gender}</p>
|
||||||
|
|
||||||
|
<input
|
||||||
|
htmlFor="age"
|
||||||
|
type="tel"
|
||||||
|
maxLength={2}
|
||||||
|
placeholder="Enter your age"
|
||||||
|
name="age"
|
||||||
|
value={personaldetail.age}
|
||||||
|
onChange={handleInputs}
|
||||||
|
/>
|
||||||
|
<p className="error-msg">{formErrors.age}</p>
|
||||||
|
<button type="button" onClick={nextPage}>
|
||||||
|
Next
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default PersonalDetail;
|
132
src/UserInfo/components/Professional/ProfessionalDetail.jsx
Normal file
132
src/UserInfo/components/Professional/ProfessionalDetail.jsx
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
function ProfessionalDetail({newSteps , setProfessionalDetail , professionaldetail}) {
|
||||||
|
|
||||||
|
const[formErrors , setFormErrors] = useState({});
|
||||||
|
|
||||||
|
let name, value;
|
||||||
|
const handleInputs = (e) => {
|
||||||
|
name = e.target.name;
|
||||||
|
value = e.target.value;
|
||||||
|
setProfessionalDetail({ ...professionaldetail, [name]: value });
|
||||||
|
setFormErrors((prevState) => ({
|
||||||
|
...prevState,
|
||||||
|
[name] : "",
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
const validate = (professionaldetail) => {
|
||||||
|
const errors = {};
|
||||||
|
|
||||||
|
if(!professionaldetail.education)
|
||||||
|
{
|
||||||
|
errors.education = "Select maximum education";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!professionaldetail.employment)
|
||||||
|
{
|
||||||
|
errors.employment = "Select Employment ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!professionaldetail.exprience || !professionaldetail.exprience < 0)
|
||||||
|
{
|
||||||
|
errors.exprience = "Enter experience ";
|
||||||
|
}
|
||||||
|
return errors;
|
||||||
|
};
|
||||||
|
|
||||||
|
function nextPage()
|
||||||
|
{
|
||||||
|
const errors = validate(professionaldetail);
|
||||||
|
setFormErrors(errors);
|
||||||
|
|
||||||
|
if(Object.keys(errors).length === 0)
|
||||||
|
newSteps(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
function previousPage()
|
||||||
|
{
|
||||||
|
newSteps(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="page" id="professional-detail">
|
||||||
|
<h1>This is Page 2</h1>
|
||||||
|
<div className="page-container" id="professional-detail-container">
|
||||||
|
<h2>Professional Detail</h2>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>Education</p>
|
||||||
|
<select
|
||||||
|
type="text"
|
||||||
|
id=""
|
||||||
|
name="education"
|
||||||
|
value={professionaldetail.education}
|
||||||
|
onChange={handleInputs}
|
||||||
|
>
|
||||||
|
<option value="other">Other</option>
|
||||||
|
<option value="PG & Above">PG & Above</option>
|
||||||
|
<option value="UG">UG</option>
|
||||||
|
<option value="12">12</option>
|
||||||
|
<option value="10">10</option>
|
||||||
|
</select>
|
||||||
|
<p className="error-msg">{formErrors.education}</p>
|
||||||
|
|
||||||
|
<p>Type of Employment</p>
|
||||||
|
<select
|
||||||
|
type="text"
|
||||||
|
id=""
|
||||||
|
name="employment"
|
||||||
|
value={professionaldetail.employment}
|
||||||
|
onChange={handleInputs}
|
||||||
|
>
|
||||||
|
<option value="Part-Time">Part-Time</option>
|
||||||
|
<option value="Internship">Internship</option>
|
||||||
|
<option value="Full-Time">Full-Time</option>
|
||||||
|
</select>
|
||||||
|
<p className="error-msg">{formErrors.employment}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
id="skills"
|
||||||
|
name="skills"
|
||||||
|
value={professionaldetail.skills}
|
||||||
|
onChange={handleInputs}
|
||||||
|
>
|
||||||
|
<p>Select Your Skills</p>
|
||||||
|
<label htmlFor="htmlAndCss"> HTML & CSS </label>
|
||||||
|
<input type="checkbox" name="htmlAndCss" id="htmlAndCss" />
|
||||||
|
<label> JavaScript</label>
|
||||||
|
<input type="checkbox" value="JavaScript" />
|
||||||
|
<label>React</label>
|
||||||
|
<input type="checkbox" value="React" />
|
||||||
|
<label>DBMS </label>
|
||||||
|
<input type="checkbox" value="DBMS" />
|
||||||
|
<label>JAVA</label>
|
||||||
|
<input type="checkbox" value="JAVA" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label> Years of Experience</label>
|
||||||
|
<input
|
||||||
|
type="tel"
|
||||||
|
name="exprience"
|
||||||
|
value={professionaldetail.exprience}
|
||||||
|
onChange={handleInputs}
|
||||||
|
maxLength={2}
|
||||||
|
placeholder="Years of Experience"
|
||||||
|
/>
|
||||||
|
<p className="error-msg">{formErrors.exprience}</p>
|
||||||
|
<button type="button" onClick={previousPage} >
|
||||||
|
Previous
|
||||||
|
</button>
|
||||||
|
<button type="button" onClick={nextPage}>
|
||||||
|
Next
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default ProfessionalDetail;
|
63
src/UserInfo/components/Review/Review.jsx
Normal file
63
src/UserInfo/components/Review/Review.jsx
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
function ReviewPage({setSteps , personaldetail , professionaldetail, setPersonalDetail, setProfessionalDetail})
|
||||||
|
{
|
||||||
|
const emptyPersonalDetail={
|
||||||
|
name:'',
|
||||||
|
email:'',
|
||||||
|
phone: '',
|
||||||
|
gender: '',
|
||||||
|
age: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
const emptyProfessionalDetail = {
|
||||||
|
education: '',
|
||||||
|
employment: '',
|
||||||
|
skills: '',
|
||||||
|
exprience: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
function previousPage(){
|
||||||
|
|
||||||
|
setSteps(2);
|
||||||
|
}
|
||||||
|
function submitMessage()
|
||||||
|
{
|
||||||
|
alert("Submit Successfully");
|
||||||
|
setPersonalDetail(emptyPersonalDetail);
|
||||||
|
setProfessionalDetail(emptyProfessionalDetail);
|
||||||
|
setSteps(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
|
||||||
|
<>
|
||||||
|
<h2>Review Details</h2>
|
||||||
|
<div className="page" id="personal-detail">
|
||||||
|
<div className="page-container" id="personal-detail-container">
|
||||||
|
<h2>Entries</h2>
|
||||||
|
<div className="content">
|
||||||
|
<p>Name: {personaldetail.name}</p>
|
||||||
|
<p>Email:{personaldetail.email}</p>
|
||||||
|
<p>Mobile No:{personaldetail.phone}</p>
|
||||||
|
<p>Gender: {personaldetail.gender}</p>
|
||||||
|
<p>Age:{personaldetail.age}</p>
|
||||||
|
<p>Education: {professionaldetail.education}</p>
|
||||||
|
<p>Employment Type: {professionaldetail.employment}</p>
|
||||||
|
<p>Skills: {professionaldetail.skills}</p>
|
||||||
|
<p>Experience: {professionaldetail.exprience}</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<button type="button" onClick={previousPage}>
|
||||||
|
Previous
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" onClick={submitMessage}>
|
||||||
|
Submit
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default ReviewPage;
|
80
src/UserInfo/global.css
Normal file
80
src/UserInfo/global.css
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
:root {
|
||||||
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
|
color-scheme: light dark;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
background-color: #242424;
|
||||||
|
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.page {
|
||||||
|
margin: 100px;
|
||||||
|
padding: 100px;
|
||||||
|
max-width: 80%;
|
||||||
|
max-height: 80%;
|
||||||
|
background-color: rgba(240, 248, 255, 0.308);
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.page-container
|
||||||
|
{
|
||||||
|
display:grid;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-container input,select
|
||||||
|
{
|
||||||
|
min-width: 400px;
|
||||||
|
min-height: 30px;
|
||||||
|
}
|
||||||
|
.page-container p
|
||||||
|
{
|
||||||
|
gap: 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
button
|
||||||
|
{
|
||||||
|
width: 100px;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: 40px;
|
||||||
|
border-width: 0;
|
||||||
|
background-color: green;
|
||||||
|
color: aliceblue;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#skills
|
||||||
|
{
|
||||||
|
background-color: rgba(0, 47, 255, 0.185);
|
||||||
|
grid-template-columns: 3fr;
|
||||||
|
display: grid;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 30px;
|
||||||
|
border-radius: 20px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-msg
|
||||||
|
{
|
||||||
|
color: rgba(255, 0, 0, 0.918);
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.content
|
||||||
|
{
|
||||||
|
background-color: rgba(50, 164, 230, 0.384);
|
||||||
|
padding: 100px;
|
||||||
|
}
|
56
src/UserInfo/index.jsx
Normal file
56
src/UserInfo/index.jsx
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
import React from "react";
|
||||||
|
import './global.css'
|
||||||
|
import PersonalDetail from "./components/Personal/PersonalDetail";
|
||||||
|
import { useState } from "react";
|
||||||
|
import ProfessionalDetail from "./components/Professional/ProfessionalDetail";
|
||||||
|
import ReviewPage from "./components/Review/Review";
|
||||||
|
import LandingPage from "./LandingPage";
|
||||||
|
|
||||||
|
const UserInfo = () => {
|
||||||
|
const [steps , setSteps] = useState(0);
|
||||||
|
const [personaldetail , setPersonalDetail] = useState({
|
||||||
|
name: "",
|
||||||
|
email: "",
|
||||||
|
phone: "",
|
||||||
|
gender: "",
|
||||||
|
age: "",
|
||||||
|
});
|
||||||
|
const [professionaldetail , setProfessionalDetail] = useState({
|
||||||
|
education: "",
|
||||||
|
employment: "",
|
||||||
|
skills: "",
|
||||||
|
exprience: "",
|
||||||
|
});
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h1>This is a Multi-Step-form</h1>
|
||||||
|
<div>
|
||||||
|
{
|
||||||
|
steps === 0 &&
|
||||||
|
<>
|
||||||
|
<LandingPage setSteps = {setSteps} setPersonalDetail = {setPersonalDetail} personaldetail = {personaldetail} setProfessionalDetail = {setProfessionalDetail} professionaldetail = {professionaldetail}/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
|
{ steps === 1 && // Inline If with Logical && Operator , yha pr props bheja h
|
||||||
|
<>
|
||||||
|
<PersonalDetail setSteps = {setSteps} setPersonalDetail = {setPersonalDetail} personaldetail = {personaldetail}/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
steps === 2 && // newSteps se koi error nhi aayega , naam kuch bhi de skte h
|
||||||
|
<>
|
||||||
|
<ProfessionalDetail newSteps = {setSteps} setProfessionalDetail = {setProfessionalDetail} professionaldetail = {professionaldetail} />
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
steps === 3 &&
|
||||||
|
<>
|
||||||
|
<ReviewPage setSteps = {setSteps} personaldetail = {personaldetail} professionaldetail = {professionaldetail} setPersonalDetail = {setPersonalDetail} setProfessionalDetail = {setProfessionalDetail}/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
};
|
||||||
|
export default UserInfo;
|
9
src/main.jsx
Normal file
9
src/main.jsx
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import { StrictMode } from 'react'
|
||||||
|
import { createRoot } from 'react-dom/client'
|
||||||
|
import App from './App.jsx'
|
||||||
|
|
||||||
|
createRoot(document.getElementById('root')).render(
|
||||||
|
<StrictMode>
|
||||||
|
<App />
|
||||||
|
</StrictMode>,
|
||||||
|
)
|
7
vite.config.js
Normal file
7
vite.config.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import react from '@vitejs/plugin-react'
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
})
|
Loading…
Reference in a new issue