Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0a983b7

Browse files
login from created using react js
1 parent e2abb55 commit 0a983b7

File tree

10 files changed

+958
-0
lines changed

10 files changed

+958
-0
lines changed

‎REACT_RECAP/sign-up-form/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

‎REACT_RECAP/sign-up-form/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

‎REACT_RECAP/sign-up-form/package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "sign-up-form",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "vite build",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
"react": "^18.2.0",
13+
"react-dom": "^18.2.0"
14+
},
15+
"devDependencies": {
16+
"@types/react": "^18.0.26",
17+
"@types/react-dom": "^18.0.9",
18+
"@vitejs/plugin-react": "^3.0.0",
19+
"vite": "^4.0.0"
20+
}
21+
}
Lines changed: 1 addition & 0 deletions
Loading[フレーム]

‎REACT_RECAP/sign-up-form/src/App.css

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
.app-container{
2+
max-width: 400px;
3+
height: auto;
4+
border-radius: 12px;
5+
padding: 40px 20px;
6+
margin: 60px auto;
7+
background-color: rgb(48, 48, 48);
8+
font-family: monospace;
9+
display: flex;
10+
flex-direction: column;
11+
position: relative;
12+
overflow: hidden;
13+
}
14+
img{
15+
max-width: 100px;
16+
margin: 12px auto;
17+
}
18+
.sign-form{
19+
display: flex;
20+
flex-direction: column;
21+
}
22+
.form-input{
23+
padding: 12px;
24+
margin: 9px 0px;
25+
border-radius: 6px;
26+
border: none;
27+
outline: none;
28+
29+
}
30+
.newsletter{
31+
display: flex;
32+
align-items: center;
33+
justify-content: center;
34+
padding: 9px;
35+
color: white;
36+
font-size: 15px;
37+
}
38+
.newsletter > input{
39+
margin-right: 6px;
40+
}
41+
button{
42+
padding: 12px;
43+
margin: 6px 45px;
44+
font-family: monospace;
45+
font-size: 18px;
46+
border-radius: 6px;
47+
border: none;
48+
background-color: rgb(163, 102, 255);
49+
color: white;
50+
box-shadow: 3px 3px 0px 0px white ;
51+
transition: .2s;
52+
53+
}
54+
button:hover{
55+
transform: translate(3px, 3px);
56+
box-shadow: 0px 0px 0px 0px white;
57+
border: none;
58+
59+
}
60+
.terminal{
61+
position: absolute;
62+
width: 250px;
63+
height: 180px;
64+
background-color: rgb(163, 102, 255);
65+
border-radius: 9px;
66+
top: 30%;
67+
left: 15%;
68+
display: none;
69+
animation: terminal .2s;
70+
}
71+
@keyframes terminal {
72+
from{transform: scale(0);}
73+
to{transform: scale(1);}
74+
}
75+
#para{
76+
margin-top: 70px;
77+
text-align: center;
78+
font-size: 18px;
79+
color: white;
80+
}
81+
#paraon{
82+
margin-top: 12px;
83+
text-align: center;
84+
font-size: 18px;
85+
color: white;
86+
}
87+
.x{
88+
position: absolute;
89+
top: 10px;
90+
right: 20px;
91+
font-size: 30px;
92+
color: white;
93+
cursor: pointer;
94+
}

‎REACT_RECAP/sign-up-form/src/App.jsx

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import React from "react";
2+
import "./App.css";
3+
import logo from "./account.png";
4+
5+
export default function App() {
6+
const [userData, setUserData] = React.useState({
7+
username: "",
8+
password: "",
9+
confirmPassword: "",
10+
newsletter: false,
11+
});
12+
console.log(userData);
13+
function handleClick(event) {
14+
setUserData((prevdata) => {
15+
const { name, type, checked, value } = event.target; //object destructuring
16+
return {
17+
...prevdata,
18+
[name]: type === "checkbox" ? checked : value,
19+
};
20+
});
21+
}
22+
23+
24+
function submitClick(event) {
25+
event.preventDefault();
26+
document.getElementById("terminal").style.display = "block";
27+
28+
if(userData.password === userData.confirmPassword){
29+
// console.log("Password is correct 😊")
30+
document.getElementById("para").textContent="Password is correct 😊"
31+
}else{
32+
// console.log("Password does not match 😫")
33+
document.getElementById("para").textContent="Password does not match 😫"
34+
document.getElementById("paraon").textContent="Try again"
35+
36+
return
37+
}
38+
if(userData.newsletter) {
39+
// console.log("Sign up Successful 🎉")
40+
document.getElementById("paraon").textContent="Sign up Successful 🎉"
41+
42+
}
43+
}
44+
function closewindow() {
45+
document.getElementById("terminal").style.display = "none";
46+
}
47+
return (
48+
<div className="app-container">
49+
<img src={logo} />
50+
<form className="sign-form">
51+
<input
52+
className="form-input"
53+
type="text"
54+
placeholder="username"
55+
name="username"
56+
value={userData.username}
57+
onChange={handleClick}
58+
/>
59+
<input
60+
className="form-input"
61+
type="password"
62+
placeholder="password"
63+
name="password"
64+
value={userData.password}
65+
onChange={handleClick}
66+
/>
67+
<input
68+
className="form-input"
69+
type="password"
70+
placeholder="confirm password"
71+
name="confirmPassword"
72+
value={userData.confirmPassword}
73+
onChange={handleClick}
74+
/>
75+
76+
<div className="newsletter">
77+
<input
78+
type="checkbox"
79+
id="confirmCheck"
80+
name="newsletter"
81+
checked={userData.newsletter}
82+
onChange={handleClick}
83+
/>
84+
<label htmlFor="confirmCheck">subscribe to our newsletter</label>
85+
</div>
86+
87+
<button onClick={submitClick}>Sign in</button>
88+
</form>
89+
<div className="terminal" id="terminal">
90+
<p id="para"></p>
91+
<p id="paraon"></p>
92+
<div className="x" onClick={closewindow}>
93+
x
94+
</div>
95+
</div>
96+
</div>
97+
);
98+
}
33.3 KB
Loading[フレーム]

‎REACT_RECAP/sign-up-form/src/main.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from "react"
2+
import ReactDOM from "react-dom/client"
3+
import App from "./App"
4+
5+
ReactDOM.createRoot(document.getElementById("root")).render(
6+
<React.StrictMode>
7+
<App/>
8+
</React.StrictMode>
9+
)

‎REACT_RECAP/sign-up-form/vite.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from 'vite'
2+
import react from '@vitejs/plugin-react'
3+
4+
// https://vitejs.dev/config/
5+
export default defineConfig({
6+
plugins: [react()],
7+
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /