|
| 1 | +import BackButton from '@components/BackButton' |
1 | 2 | import React from 'react' |
| 3 | +import { useNavigate } from 'react-router-dom' |
| 4 | +import CommentSection from './CommentSection' |
| 5 | + |
| 6 | +interface CommentType { |
| 7 | + writer: string |
| 8 | + title: string |
| 9 | + createdAt: string |
| 10 | + id: number |
| 11 | +} |
2 | 12 |
|
3 | 13 | function ManageComment() { |
4 | | - return <div>댓글관리에용</div> |
| 14 | + const navigate = useNavigate() |
| 15 | + const COMMENTS = [ |
| 16 | + { id: 1, writer: '모승', title: '실험인데용', createdAt: '2022.10.01' }, |
| 17 | + { id: 2, writer: '모승', title: '실험인데용', createdAt: '2022.10.01' }, |
| 18 | + { id: 3, writer: '모승', title: '실험인데용', createdAt: '2022.10.01' }, |
| 19 | + ] |
| 20 | + const recordId = 270 |
| 21 | + const ALL_POSTS = [1, 2, 3, 4, 5] |
| 22 | + |
| 23 | + return ( |
| 24 | + <div className="px-6 pt-4"> |
| 25 | + <div className="flex justify-between pb-8"> |
| 26 | + <BackButton /> |
| 27 | + <p className="cursor-pointer text-xs font-medium text-primary-2"> |
| 28 | + 선택 |
| 29 | + </p> |
| 30 | + </div> |
| 31 | + <div className="flex justify-end"> |
| 32 | + <p>최신순</p> |
| 33 | + </div> |
| 34 | + <div> |
| 35 | + {ALL_POSTS.map((src) => ( |
| 36 | + <section key={src} className="mt-4 flex flex-col items-start pr-4"> |
| 37 | + <p className="mb-4">2022.12.01</p> |
| 38 | + <CommentSection |
| 39 | + parentCategoryId={1} |
| 40 | + recordId={350} |
| 41 | + colorName={`bg-icon-purple`} |
| 42 | + title={'실험인데요'} |
| 43 | + writer={'모송'} |
| 44 | + numOfComment={5} |
| 45 | + iconName={'gift'} |
| 46 | + /> |
| 47 | + <section className="flex w-full flex-col gap-2 pl-[56px]"> |
| 48 | + {COMMENTS.map(({ writer, title, createdAt, id }: CommentType) => ( |
| 49 | + <div key={id} className="w-full rounded-[8px] bg-grey-2 p-3"> |
| 50 | + <div className="flex"> |
| 51 | + <p className=" mr-2 text-xs font-medium">{writer}</p> |
| 52 | + <p className="text-xs font-normal text-grey-5"> |
| 53 | + {createdAt} |
| 54 | + </p> |
| 55 | + </div> |
| 56 | + <p className="text-xs font-normal text-grey-8">{title}</p> |
| 57 | + </div> |
| 58 | + ))} |
| 59 | + <p |
| 60 | + onClick={() => navigate(`/record/${recordId}`)} |
| 61 | + className="cursor-pointer text-xs font-normal text-grey-7" |
| 62 | + > |
| 63 | + 전체보기 |
| 64 | + </p> |
| 65 | + </section> |
| 66 | + </section> |
| 67 | + ))} |
| 68 | + </div> |
| 69 | + </div> |
| 70 | + ) |
5 | 71 | } |
6 | 72 |
|
7 | 73 | export default ManageComment |
0 commit comments