-
Notifications
You must be signed in to change notification settings - Fork 0
/
PostList.jsx
48 lines (43 loc) · 1.22 KB
/
PostList.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React from "react";
import styled from "styled-components";
import PostItem from "../page/PostItem";
const Wrapper = styled.div`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
// &>*{
// :not(:last-child){
// margin-bottom: 0px;
// }
}
`;
const TopName = styled.div`
box-sizing : border-box;
background-color : #48484A;
width:320px;
color : #fff;
font-size: 16px;
display : flex;
align-items: center;
padding-left: 12px;
height: 32px;
border-radius : 8px 8px 0px 0px;
margin-bottom: 8px;
`;
// 카드 간격이 좁혀지지 않음
function PostList(props){
//posts: 전체 글 데이터 //onClickItem : 아이템을 클릭했을 때 작동할 함수
const{posts, onClickItem} = props;
return(
<Wrapper>
<TopName>오늘의 새 글 </TopName>
{posts.map((post, index)=>{
return(
<PostItem key={post.id} post={post} onClick={()=>onClickItem(post)}></PostItem> //여기서 매개변수가 결정
)
})}
</Wrapper>
)
}
export default PostList;