forked from EFUB/efub4-first-react-study
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainPage.jsx
51 lines (47 loc) Β· 1.08 KB
/
MainPage.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
49
50
51
import React from "react";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import PostList from "../list/PostList";
import Button from "../UI/Button";
import data from "../../data.json";
const Wrapper = styled.div`
width: calc(100%-32px);
padding: 16px;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
`;
const Container = styled.div`
width: 100$;
max-width: 720px;
& > * {
:not(:last-child) {
margin-bottom: 16px;
}
}
`;
function MainPage(props) {
const {} = props;
const navigate = useNavigate();
return (
<Wrapper>
<Container>
<Button
title="κΈ μμ±νκΈ°"
onClick={() => {
navigate("/post-write");
}}
>
<PostList
posts={data}
onClickItem={(item) => {
navigate(`/post/${item.id}`);
}}
></PostList>
</Button>
</Container>
</Wrapper>
);
}
export default MainPage;