diff --git a/simplediary/src/App.css b/simplediary/src/App.css index 2848e390..467e5f6a 100644 --- a/simplediary/src/App.css +++ b/simplediary/src/App.css @@ -26,3 +26,37 @@ textarea { padding: 10px; cursor: pointer; } + +/* List */ +.DiaryList { + border: 1px solid gray; + padding: 20px; + margin-top: 20px; +} + +.DiaryList h2 { + text-align: center; +} + +/* Item */ +.DiaryItem { + background-color: rgb(240, 240, 240); + margin-bottom: 10px; + padding: 20px; +} + +.DiaryItem .info { + border-bottom: 1px solid gray; + padding-bottom: 10px; + margin-bottom: 10px; +} + +.DiaryItem .date { + color: gray; +} + +.DiaryItem .content { + font-weight: bold; + margin-bottom: 30px; + margin-top: 30px; +} diff --git a/simplediary/src/App.js b/simplediary/src/App.js index b3e8f578..e8e036dc 100644 --- a/simplediary/src/App.js +++ b/simplediary/src/App.js @@ -1,12 +1,38 @@ import "./App.css"; import DiaryEditor from "./DiaryEditor"; +import DiaryList from "./DiaryList"; -function App() { +const dummyList = [ + { + id: 1, + author: "kim", + content: "hihi", + emotion: 5, + created_date: new Date().getTime(), + }, + { + id: 2, + author: "lee", + content: "hihi", + emotion: 2, + created_date: new Date().getTime(), + }, + { + id: 3, + author: "park", + content: "hihi", + emotion: 4, + created_date: new Date().getTime(), + }, +]; + +const App = () => { return (
+
); -} +}; export default App; diff --git a/simplediary/src/DiaryItem.js b/simplediary/src/DiaryItem.js new file mode 100644 index 00000000..b7c8d37e --- /dev/null +++ b/simplediary/src/DiaryItem.js @@ -0,0 +1,16 @@ +const DiaryItem = ({ author, content, created_date, emotion, id }) => { + return ( +
+
+ + 작성자 : {author} | 감정 점수 : {emotion} + +
+ {new Date(created_date).toLocaleString()} +
+
{content}
+
+ ); +}; + +export default DiaryItem; diff --git a/simplediary/src/DiaryList.js b/simplediary/src/DiaryList.js new file mode 100644 index 00000000..8ec4aa56 --- /dev/null +++ b/simplediary/src/DiaryList.js @@ -0,0 +1,21 @@ +import DiaryItem from "./DiaryItem"; + +const DiaryList = ({ diaryList }) => { + return ( +
+

일기 리스트

+

{diaryList.length}개의 일기가 있습니다.

+
+ {diaryList.map((it) => ( + + ))} +
+
+ ); +}; + +DiaryList.defaultProps = { + diaryList: [], +}; + +export default DiaryList;