Skip to content
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

Amazon Cart Assignment solution (shopping cart, modal and wishlist added) #96

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e4f2dd7
hard promises done!
Vortex-21 Aug 22, 2024
88bc5b6
removed function calls for testing locally
Vortex-21 Aug 22, 2024
f435a09
Merge branch '100xdevs-cohort-3:main' into main
Vortex-21 Sep 15, 2024
3110147
Merge branch '100xdevs-cohort-3:main' into main
Vortex-21 Oct 18, 2024
85f4791
updated assignments
Vortex-21 Oct 20, 2024
6e18443
Week-10 assignment complete (without pagination)
Vortex-21 Oct 20, 2024
4f8757f
pagination added !
Vortex-21 Oct 21, 2024
0c6350f
Merge branch 'main' of https://github.com/100xdevs-cohort-3/assignments
Vortex-21 Oct 24, 2024
803d2d4
pre-modal complete
Vortex-21 Oct 27, 2024
fa159f7
components structured in seperate files .
Vortex-21 Oct 28, 2024
751029a
modal+overlay added !
Vortex-21 Oct 29, 2024
0b8bd5b
Merge branch '100xdevs-cohort-3:main' into main
Vortex-21 Oct 29, 2024
83e905b
new init
Vortex-21 Oct 29, 2024
ad20e56
Modal Container added !
Vortex-21 Oct 29, 2024
6873f6c
routing added !
Vortex-21 Oct 29, 2024
c08c160
wishlist-basic-working
Vortex-21 Nov 4, 2024
5c4d1a2
wishlist-basic-working
Vortex-21 Nov 4, 2024
ef542eb
damage-control
Vortex-21 Nov 4, 2024
9f318ef
reverted-to-working
Vortex-21 Nov 4, 2024
3e3061c
minor-issue-fix-trial1
Vortex-21 Nov 4, 2024
7e1b28c
wishlist-functionality-added!
Vortex-21 Nov 5, 2024
f667eb1
minor issues fixes and code format
Vortex-21 Nov 5, 2024
7519028
Merge branch '100xdevs-cohort-3:main' into main
Vortex-21 Nov 10, 2024
4fe7a50
Merge branch 'main' of https://github.com/Vortex-21/assignments into …
Vortex-21 Nov 10, 2024
3e35151
updated assignments
Vortex-21 Oct 20, 2024
faf2238
Week-10 assignment complete (without pagination)
Vortex-21 Oct 20, 2024
768dc53
pagination added !
Vortex-21 Oct 21, 2024
f9ff029
pre-modal complete
Vortex-21 Oct 27, 2024
dd69e7c
components structured in seperate files .
Vortex-21 Oct 28, 2024
29a9664
modal+overlay added !
Vortex-21 Oct 29, 2024
2d60415
new init
Vortex-21 Oct 29, 2024
588fc4c
Modal Container added !
Vortex-21 Oct 29, 2024
3aa1658
wishlist-basic-working
Vortex-21 Nov 4, 2024
7ec8180
routing added !
Vortex-21 Oct 29, 2024
a54acc0
damage-control
Vortex-21 Nov 4, 2024
d383d79
reverted-to-working
Vortex-21 Nov 4, 2024
53d8c30
minor-issue-fix-trial1
Vortex-21 Nov 4, 2024
d63cb4d
wishlist-functionality-added!
Vortex-21 Nov 5, 2024
ff988ff
minor issues fixes and code format
Vortex-21 Nov 5, 2024
90a5b7f
Merge branch 'personal' of https://github.com/Vortex-21/assignments i…
Vortex-21 Nov 10, 2024
9311177
drawer animation added (with toggle button bug.)
Vortex-21 Nov 11, 2024
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
23 changes: 20 additions & 3 deletions week-10/authSystem/src/components/AppBar.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
import React from 'react'
import React, { useState } from 'react'
import Login from './Login'

const AppBar = () => {
const [loggedIn, setLoggedIn] = useState(false);
const [username, setUsername] = useState("");

function login(username) {
setLoggedIn(true);
setUsername(username);
}
function logout(){
setLoggedIn(false);
setUsername("");
}
return (
<div>AppBar</div>
<div style={{ backgroundColor : "rgb(64, 152, 181)", height:"100px", display:"flex",padding:10}}>
<div>
<h1 style={{color:"white"}}>Auth System</h1>
</div>
{loggedIn ? <div style={{marginLeft:"auto", fontSize:"30px", color:"white", display:"flex"}}>Welcome {username} <button onClick={logout} style={{height:"30px", marginLeft:10}}>Logout</button></div> : <Login login={login}/>}
</div>
)
}

export default AppBar
export default AppBar
Empty file.
38 changes: 31 additions & 7 deletions week-10/authSystem/src/components/Login.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
import React from 'react'

const Login = () => {
import React from "react";
import {useState,useRef} from "react"
const Login = ({login}) => {
const nameRef = useRef(null);
const passwordRef = useRef(null);
function signin(){
//assuming successful login
login(nameRef.current.value);
}
return (
<div>Login</div>
)
}
<div style={{marginLeft:"auto"}}>
<div>
<input
ref={nameRef}
type="text"
placeholder="Username"
id="username"
style={{height:"30px", margin:10}}
/>
<input
ref={passwordRef}
type="password"
placeholder="Password"
id="password"
style={{height:"30px", margin:10}}
/>
<button style={{height:"35px", margin:10}} onClick={signin}>Login</button>
</div>
</div>
);
};

export default Login
export default Login;
61 changes: 55 additions & 6 deletions week-10/userApi/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,61 @@
import RandomUser from './components/RandomUser'
import { useState, useEffect } from "react";

import UserCollection from "./components/UserCollection"
import Pagination from "./components/Pagination";
function App() {
const [users, setUsers] = useState([]);
const [usersPerPage, setUsersPerPage] = useState(30);
const [currentPage, setCurrentPage] = useState(1);
const [loading,setLoading] = useState(false);
//range of one page : [(currentPage-1)*usersPerPage, currentPage*usersPerPage]
async function getUser() {
let response = await fetch("https://randomuser.me/api/");
response = await response.json();

console.log(response);
return response;
}

async function addUsers() {
setLoading(true);
let newUsers=[]
for(let i=1;i<=10;i++){
let response = await getUser();

let name = `${response.results[0].name.first} ${response.results[0].name.last}`;
let image = response.results[0].picture.large;
newUsers.push({userImage: image, userName:name})
}

setUsers((prev) => [
...prev,
...newUsers,
]);
setLoading(false);
}

useEffect(() => {
addUsers();
}, []);

function nextPage(){
setCurrentPage(prev => prev+1);
}
function prevPage(){
setCurrentPage(prev => prev-1);
}
const usersToShow = users.slice(((currentPage-1)*usersPerPage), (currentPage*usersPerPage));
return (
<>
<RandomUser />
</>
)
<div style={{ textAlign: "center" }}>
<h1>Random Users</h1>
<UserCollection usersToShow={usersToShow} loading={loading}/>
{currentPage > 1 && <button onClick={prevPage}>Prev Page</button>}
<button onClick={addUsers}>Add</button>
{users.length > usersPerPage && <button onClick={nextPage}>NextPage</button>}

<Pagination totalUsers={users.length} usersPerPage={usersPerPage} setCurrentPage={setCurrentPage}/>
</div>
);
}

export default App
export default App;
4 changes: 2 additions & 2 deletions week-10/userApi/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import App from './App.jsx'
import './index.css'

createRoot(document.getElementById('root')).render(
<StrictMode>

<App />
</StrictMode>,

)
9 changes: 8 additions & 1 deletion week-11/amazonCart/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Dancing+Script:[email protected]&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Rouge+Script&family=Rubik:ital,wght@0,300..900;1,300..900&display=swap"
rel="stylesheet"
/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" rel="stylesheet"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
Expand Down
Loading