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

Part2 성은지 week7 #308

Open
wants to merge 3 commits into
base: part2-성은지
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
6 changes: 6 additions & 0 deletions W2/react-project/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
3 changes: 3 additions & 0 deletions W2/react-project/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
105 changes: 105 additions & 0 deletions W2/react-project/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions W2/react-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"styled-components": "^6.1.1",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand All @@ -34,5 +35,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"prettier": "^3.1.0"
}
}
Binary file removed W2/react-project/public/favicon.ico
Binary file not shown.
41 changes: 9 additions & 32 deletions W2/react-project/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,19 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"

<link
rel="stylesheet"
as="style"
crossorigin
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/variable/pretendardvariable-gov-dynamic-subset.css"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Linkbrary_Part 2 Weekly Mission</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script src="/src/index.js"></script>

</body>
</html>
Binary file removed W2/react-project/public/logo192.png
Binary file not shown.
Binary file removed W2/react-project/public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions W2/react-project/public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions W2/react-project/public/robots.txt

This file was deleted.

58 changes: 40 additions & 18 deletions W2/react-project/src/App.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,57 @@
// import logo from "./logo.svg";
import { useState } from "react";
import "./styles/App.css";
import "./styles/Global.css";
import CardList from "./components/CardList";
import Search from "./components/Search";
import Header from "./components/Header";
import Main from "./components/Main";
import Footer from "./components/Footer";
import Bookmark from "./components/Bookmark";
import "./styles/App.css";
import "./styles/Global.css";
import Sort from "./components/Sort"
import { useEffect, useState } from "react";


async function getFetchCards() {
const response = await fetch(
"https://bootcamp-api.codeit.kr/api/users/1/links",
);
const body = await response.json();

return body;
}


function App() {
// const [profile, setProfile] = useState(null);
const [links, setLinks] = useState([]);

const getCards = async () => {
const {data} = await getFetchCards();

setLinks(data);
};

const handleClickAll = async () => {
const {data: links} = await getFetchCards();

setLinks(links)
}

// async function sendHeader() {
// const { email, profileImageSource } = await GetUser();
const handleClickButton = async (id) => {
const {data: links} = await getFetchCards();

// setProfile((prevValue) => ({
// ...prevValue,
// email,
// profileImageSource,
// }));
const filteredLinks =
links.filter((({folder_id}) => folder_id === id));

// return profile
// }
setLinks(filteredLinks)
}

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

return (
<div>
<Header />
<Bookmark />
<Search />
<Main />
<Sort handleClickButton={handleClickButton} handleClickAll={handleClickAll}/>
<CardList links={links}/>
<Footer />
</div>
);
Expand Down
Binary file added W2/react-project/src/assets/kebab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions W2/react-project/src/assets/link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added W2/react-project/src/assets/pen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added W2/react-project/src/assets/share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added W2/react-project/src/assets/trash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading