diff --git a/src/App.js b/src/App.js deleted file mode 100644 index 84b33ac..0000000 --- a/src/App.js +++ /dev/null @@ -1,5 +0,0 @@ -function App() { - return <>Super Hero App; -} - -export default App; diff --git a/src/App.jsx b/src/App.jsx new file mode 100644 index 0000000..97e4be0 --- /dev/null +++ b/src/App.jsx @@ -0,0 +1,23 @@ + +import { useEffect, useState } from 'react'; +import Home from './pages/Home'; + +function App() { + const [superHero, setSuperHero] = useState({}); + useEffect(() => { + fetch('https://superheroapi.com/api.php/10160086797479102/226') + .then((response) => response.json()) + .then((jsonData) => { + setSuperHero(jsonData); + }); + console.log(superHero); + }, []); + return ( + <> + + + + ); +} + +export default App; diff --git a/src/pages/Home.css b/src/pages/Home.css new file mode 100644 index 0000000..e8f4698 --- /dev/null +++ b/src/pages/Home.css @@ -0,0 +1,97 @@ +.center{ + display: flex; + justify-content: center; + align-items: center; + width: 100vw; + height: 100vh; + background-color: bisque; + + +} + + +.home{ + background-color: aqua; + width: 500px; + height: fit-content; + display: flex; + flex-direction: column; + justify-content: flex-end; + align-items: flex-start; + padding: 50px; + background-image: url("https://i.pinimg.com/736x/e7/5d/60/e75d609bdb187415e096f436187bb5c3.jpg"); + background-repeat: no-repeat; + background-size: cover; + background-position: -35px; + border-radius: 25px; + box-shadow: 0px 0px 20px ; + +} + + + +.h1{ + color: rgb(165, 137, 137); + font-weight: bold; + text-decoration: underline; + + display: flex; + + justify-content: center; + + width: 100%; + +} + + + + +.img { + + width: 200px; + + height: 200px; + + border-radius: 20px; + + object-fit: cover; + + box-shadow: 0px 0px 20px rgba(223, 65, 65, 0.557); + + position: relative; + + left: 20%; + +} + +.Title { + + color: rgb(221, 136, 26); + + font-weight: bold; + + font-size: 18px; + + margin-bottom: 10px; + +} + + + + +.Paragraph { + + font-size: 16px; + + color: antiquewhite; + + padding-bottom: 20px; + + padding-left: 20px; + + width: 50%; + + line-height: 1.5rem; + +} + diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx new file mode 100644 index 0000000..8e2d4be --- /dev/null +++ b/src/pages/Home.jsx @@ -0,0 +1,52 @@ +import React from "react"; +import "./Home.css" + +function Home({ superHero }) { + console.log(superHero); + return ( +
+
+

{superHero.name}

+

+ Occupation :

+

+ + {superHero.work && + superHero.work.occupation} + +

+ Group +

+ + {superHero.connection && + superHero.connection[ + "group-affiliation" + ]} + +
+ + {superHero.image && ( + {superHero.name} + )} + +
+
+
+ ); +} + + + + + + +export default Home;