Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/node_modules
/.pnp
.pnp.js
.env

# testing
/coverage
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Favourite Super Hero Task
# Favourite Super Hero
## Final result :

![alt-text](https://github.com/Aya-Jafar/super-hero-task/blob/master/Screenshot%202023-08-18%20at%2011.49.56%20PM.png)

<br/>

Dear students,

Expand Down
Binary file added Screenshot 2023-08-18 at 11.49.56 PM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17,102 changes: 17,102 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
Expand Down Expand Up @@ -34,5 +36,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"http-proxy-middleware": "^2.0.6"
}
}
259 changes: 235 additions & 24 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,249 @@
.App {
text-align: center;
* {
color: white;
}

.wrapper {
background: rgb(221, 62, 86);
background: linear-gradient(
180deg,
rgba(221, 62, 86, 1) 0%,
rgba(187, 52, 111, 1) 50%,
rgba(139, 39, 143, 1) 100%
);
height: 100vh;

display: flex;
align-items: center;
justify-content: center;
}

.main-div {
height: 80vh;
width: 80vw;
border-radius: 20px;
background-color: #0a0a0a;
display: flex;
flex-direction: column;
}

.first-section {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 5%;
flex-wrap: wrap;
}

strong {
color: rgb(241, 59, 59);
}

.search-input-container {
position: relative;
margin-top: 1%;
}

.search-input {
/* padding: 7px 90px; */
font-size: 17px;
border: 1px solid #ccccccbe;
border-radius: 20px;
outline: none;
width: 25vw;
padding: 7px 10px;
margin-top: 1%;
background-color: #0a0a0abf;

text-align: start;
}

.search-icon {
position: absolute;
top: 50%;
left: 10px;
transform: translateY(-50%);
color: #ccc; /* Change the color of the search icon */
}

.App-logo {
height: 40vmin;
pointer-events: none;
.content {
/* background-color: #ccc; */
width: 90%;
height: 80%;
margin-top: 1%;
margin-left: 5%;
display: flex;
align-items: center;
/* justify-content: space-around; */
justify-content: start;
gap: 5%;
flex-wrap: wrap;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
.content img {
width: 35%;
height: 90%;
padding-left: 3%;
border-radius: 10px;
}
.content h1 {
font-size: 40px;
font-weight: 700;
}

.App-header {
background-color: #282c34;
min-height: 100vh;
.info {
display: flex;
flex-direction: column;
}

.tabs-line {
display: flex;
gap: 6%;
/* width: 500px; */
width: 35vw;

/* font-weight: 500;
font-size: 17px; */

border-bottom: 2px solid rgba(255, 255, 255, 0.1);

margin-bottom: 10%;
cursor: pointer;
}

.power-container {
display: flex;
flex-direction: column;
}

.power-item {
display: flex;
justify-content: space-between;
align-items: start;
margin-bottom: 30px;
font-weight: 600;
font-size: 18px;
}

.power-num {
color: #fcc740;
font-weight: bold;
}

.name-icon {
display: flex;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
gap: 30px; /* Adjust this value as needed */
}

.name-icon .icon {
flex-shrink: 0;
}

.name-icon .label {
flex-grow: 1;
font-weight: bold;
}

.active {
border-bottom: 4px solid #f13c3b;
margin-bottom: 1.4px;
}

.biography-item {
display: flex;
gap: 10px;
}

.App-link {
color: #61dafb;
.biography-container {
display: flex;
flex-direction: column;
justify-content: space-around;
gap: 40px;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
.key {
font-weight: 700;
/* color:#4F4F4F */
color: #fcc740;
}
.appearance-container {
display: flex;
flex-direction: column;
gap:20px
}
.appearance-item{
display: flex;
justify-content: space-between;
font-weight: 600;
font-size: 18px;
}

.name-icon .appearance div{
font-weight: 700;
}

.appearance-value{
background-color: #F06259;
padding: 1% 2%;
border-radius: 15px;
}


.connection-container{
margin: 0;
padding: 0;
/* background-color: red; */
display: flex;
flex-direction: column;
justify-content: space-around;
gap:100px;
margin-top: 15px;
}

.connection-item{
display: flex;
flex-direction: column;
gap:10px
}

.bold-yellow {
color: yellow;
width: 3px;
height: 10px;
}

.yellow-and-text{
display: flex;
gap:10px;
font-size: 17px;
font-weight: 700;
}

.search-results{
position: absolute;
display: flex;
flex-direction: column;
margin-top: 2%;
background-color: #131313;
width: 25vw;
padding-left: 5%;
height: 70vh;
max-height: 70vh;
overflow-y: scroll;

}

.search-item{
display: flex;
margin-top: 5%;
margin-bottom: 5%;
font-size: 16px;
gap:20px;
align-items: center;
cursor: pointer;
}

.search-img img{
width: 50px;
height: 60px;
}
5 changes: 0 additions & 5 deletions src/App.js

This file was deleted.

15 changes: 15 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Wrapper from "./components/Wrapper";
import "./App.css";
import { DataProvider } from "./providers/dataProvider";

function App() {
return (
<>
<DataProvider>
<Wrapper />
</DataProvider>
</>
);
}

export default App;
49 changes: 49 additions & 0 deletions src/components/Content.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React, { useContext, useState } from "react";
import Tab from "./Tab";
import PowersTab from "./tabs/PowersTab";
import BiographyTab from "./tabs/BiographyTab";
import AppearanceTab from "./tabs/AppearanceTab";
import ConnectionTab from "./tabs/ConnectionTab";
import Context from "../providers/dataProvider";


function Content() {
const { currentData, setCurrentData } = useContext(Context);

const [currentTab, setCurrentTab] = useState("powerstats");

const handleTabSelect = (tab) => setCurrentTab(tab);


const generateTabContent = (tab) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loved how you used a switch case for this kind of condition that involves several situations and also how you used it to render components

switch (tab) {
case "powerstats":
return <PowersTab />;
case "biography":
return <BiographyTab />;
case "appearance":
return <AppearanceTab />;
case "connections":
return <ConnectionTab />;
default:
return null;
}
};

return (
<div className="content">
{currentData && <img src={currentData.image} alt="" />}
<div className="info">
{currentData && (
<>
{currentData.info && <h1>{currentData.info.name.toUpperCase()}</h1>}
<Tab onSelectTab={handleTabSelect} />
{generateTabContent(currentTab)}
</>
)}
</div>
</div>
);
}

export default Content;
Loading