diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..3c3629e64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/package-lock.json b/package-lock.json index 44cde1123..b0128443d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,11 @@ { - "name": "web-sprint-challenge-intro-to-react", + "name": "fsweb-s6-challenge-intro-to-react", "version": "0.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { + "name": "fsweb-s6-challenge-intro-to-react", "version": "0.1.1", "dependencies": { "@testing-library/jest-dom": "^5.16.2", @@ -18807,7 +18808,9 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "requires": {} + "requires": { + "ajv": "^8.0.0" + } }, "ajv-keywords": { "version": "5.1.0", @@ -22104,7 +22107,9 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "requires": {} + "requires": { + "ajv": "^8.0.0" + } }, "ajv-keywords": { "version": "5.1.0", @@ -24679,6 +24684,7 @@ "is-glob": "^4.0.3", "normalize-path": "^3.0.0", "object-hash": "^2.2.0", + "postcss": "^8.4.6", "postcss-js": "^4.0.0", "postcss-load-config": "^3.1.0", "postcss-nested": "5.0.6", @@ -25207,7 +25213,9 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "requires": {} + "requires": { + "ajv": "^8.0.0" + } }, "ajv-keywords": { "version": "5.1.0", @@ -25287,7 +25295,9 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "requires": {} + "requires": { + "ajv": "^8.0.0" + } }, "ajv-keywords": { "version": "5.1.0", diff --git a/src/App.js b/src/App.js index 04dc89af4..1d04bd3fa 100644 --- a/src/App.js +++ b/src/App.js @@ -1,18 +1,60 @@ -import React from 'react'; +import React from "react"; +import { useEffect, useState } from "react"; +import Section from "./Section"; +import axios from "axios"; +import Arama from "./Arama"; const App = () => { // Try to think through what state you'll need for this app before starting. Then build out // the state properties here. - // Fetch characters from the API in an effect hook. Remember, anytime you have a + // Fetch characters from the API in an effect hook. Remember, anytime you have a // side effect in a component, you want to think about which state and/or props it should // sync up with, if any. + const [data, setData] = useState([]); + const [arama, setArama] = useState(""); + const [icerik, setIcerik] = useState(""); + + useEffect(() => { + axios + .get("https://swapi.dev/api/people/") + .then((response) => setData(response.data)); + }, []); + + function handleClick(name) { + setIcerik(name === icerik ? null : name); + } return (
Gender: {data.gender}
+Height: {data.height}
+Mass: {data.mass}
+BirthYear: {data.birth_year}
+Eye Color: {data.eye_color}
+Hair Color: {data.hair_color}
+Skin Color: {data.skin_color}
+ {Appears in {data.films.length} films
} +