Skip to content

router updated to v@6 and signup form added #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"@testing-library/user-event": "^7.1.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1"
"react-router-dom": "^6.4.3",
"react-scripts": "^3.4.1"
},
"scripts": {
"start": "react-scripts start",
Expand Down
62 changes: 61 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,71 @@
font-size: 100px;
}

.sign-up {
.sign-up-card {
background-image: url('/images/img-8.jpg');
background-position: center;
background-size: cover;
background-repeat: no-repeat;
color: #fff;
height: 90vh;
padding: 2rem;
font-size: 100px;
}

.sign-up-form {
border-radius: 7px;
border: 1px solid grey;
max-width: 600px;
width: 30%;
margin: 0 auto;
background-color: white;
padding: 20px;
box-shadow: 0 2px 4px 4px rgba(0,0,0,0.09);
/* margin-top: 2rem; */
}

.sign-up-form h2 {
font-size: 30px;
color:black;
font-weight: 500;
margin-bottom: 30px;
text-align: center;
}

.each-input {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 20px;
font-weight: 100;
}

.each-input label {
font-size: 18px;
color: black;
}

.each-input input {
font-size: 20px;
padding: 10px;
border-radius: 6px;
border: 1px solid grey;

}

.submit-button button{
background-color:black;
color: white;
border-radius: 40rem;
width: 60%;
margin: 0 auto;
font-size: 25px;
padding: 8px;
text-align: center;
cursor: pointer;
}

.submit-button {
text-align: center;
margin: 0 auto;
}
33 changes: 16 additions & 17 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import React from 'react';
import Navbar from './components/Navbar';
import './App.css';
import Home from './components/pages/Home';
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
import Services from './components/pages/Services';
import Products from './components/pages/Products';
import SignUp from './components/pages/SignUp';
import React from "react";
import Navbar from "./components/Navbar";
import "./App.css";
import Services from "./components/pages/Services";
import Products from "./components/pages/Products";
import SignUp from "./components/pages/SignUp";
import { Routes, Route } from "react-router-dom";
import Home from "./components/pages/Home";

function App() {
return (
<>
<Router>
<Navbar />
<Switch>
<Route path='/' exact component={Home} />
<Route path='/services' component={Services} />
<Route path='/products' component={Products} />
<Route path='/sign-up' component={SignUp} />
</Switch>
</Router>
<Navbar />
<Routes>
<Route path="/" element={<Home />} />
<Route path="/services" element={<Services />} />
<Route path="/products" element={<Products />} />
<Route path="/sign-up" element={<SignUp />} />
<Route path='*' element={<h1>Not Found</h1>} />
</Routes>
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Navbar() {
<div className='navbar-container'>
<Link to='/' className='navbar-logo' onClick={closeMobileMenu}>
TRVL
<i class='fab fa-typo3' />
<i className='fab fa-typo3' />
</Link>
<div className='menu-icon' onClick={handleClick}>
<i className={click ? 'fas fa-times' : 'fas fa-bars'} />
Expand Down
68 changes: 65 additions & 3 deletions src/components/pages/SignUp.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,68 @@
import React from 'react';
import '../../App.css';
import React, { useState } from "react";
import "../../App.css";
import { Button } from "../Button";

export default function SignUp() {
return <h1 className='sign-up'>LIKE & SUBSCRIBE</h1>;
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");

const [details, setDetails] = useState(true);

const submitHandler = (e) => {
e.preventDefault();
if (name && email && password) {
setDetails(true);
const details = {
name,
email,
password,
};

console.log(details);
} else {
setDetails(false);
}
};

return (
<div className="sign-up-card">
<form className="sign-up-form" onSubmit={submitHandler}>
<h2>Sign Up form</h2>
<div className="each-input">
<label>Name</label>
<input
value={name}
onChange={(e) => setName(e.target.value)}
type="text"
/>
</div>
<div className="each-input">
<label>Email</label>
<input
value={email}
onChange={(e) => setEmail(e.target.value)}
type="text"
/>
</div>
<div className="each-input">
<label>Password</label>
<input
value={password}
onChange={(e) => setPassword(e.target.value)}
type="text"
/>
</div>
{!details && (
<h3 style={{ color: "red", fontSize: "12px" }}>
fill proper details
</h3>
)}

<div className="submit-button">
<button>Sign Up</button>
</div>
</form>
</div>
);
}
15 changes: 11 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import { BrowserRouter } from "react-router-dom";

ReactDOM.render(<App />, document.getElementById('root'));
ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>,

document.getElementById("root")
);