From 4c4f0615ae0738a0fe4c193f3048aef55d7b0464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=9B=90=EC=98=81?= Date: Sun, 25 Jun 2023 12:19:47 +0000 Subject: [PATCH] =?UTF-8?q?14.4=20ui=20=EB=A7=8C=EB=93=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- news-viewer/package.json | 1 + news-viewer/src/App.js | 52 ++++---- news-viewer/src/components/NewsItem.js | 58 +++++++++ news-viewer/src/components/NewsList.js | 39 ++++++ news-viewer/yarn.lock | 174 ++++++++++++++++++++++--- 5 files changed, 285 insertions(+), 39 deletions(-) create mode 100644 news-viewer/src/components/NewsItem.js create mode 100644 news-viewer/src/components/NewsList.js diff --git a/news-viewer/package.json b/news-viewer/package.json index f83adb1..fffc15c 100644 --- a/news-viewer/package.json +++ b/news-viewer/package.json @@ -10,6 +10,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", + "styled-components": "^6.0.0-rc.6", "web-vitals": "^2.1.0" }, "scripts": { diff --git a/news-viewer/src/App.js b/news-viewer/src/App.js index 56adb4d..529b3eb 100644 --- a/news-viewer/src/App.js +++ b/news-viewer/src/App.js @@ -1,29 +1,35 @@ import { useState } from 'react'; import axios from 'axios'; import newsjson from './news' +import NewsList from './components/NewsList'; + const App = () => { - const [data, setData] = useState(null); - const onClick = async () => { - try{ - // const response = await axios.get( - // 'https://newsapi.org/v2/top-headlines?country=kr&apiKey=8378a7d0ee24456ba337d378adde3f51', - // ); - // setData(response.data); - setData(newsjson) - }catch(e){ - console.log(e); - } - }; - - return( -
-
- -
- {data &&