|
| 1 | +import React from "react"; |
| 2 | +import "./Community.css"; |
| 3 | + |
| 4 | +export default function Community() { |
| 5 | + const posts = [ |
| 6 | + { |
| 7 | + title: "버블 정렬 시각화 프로젝트 공유합니다", |
| 8 | + summary: "버블 정렬 알고리즘을 시각적으로 이해하기 쉽게 구현해보았습니다. 피드백 부탁드려요!", |
| 9 | + tags: ["알고리즘", "정렬", "시각화"], |
| 10 | + author: "김코딩", |
| 11 | + date: "2023. 5. 15", |
| 12 | + likes: 24, |
| 13 | + comments: 8, |
| 14 | + thumbnail: "https://via.placeholder.com/300x180" |
| 15 | + }, |
| 16 | + { |
| 17 | + title: "그래프 탐색 알고리즘 비교: BFS vs DFS", |
| 18 | + summary: "그래프 탐색 알고리즘의 차이점을 비교하고 어떤 상황에서 더 적합한지 정리했습니다.", |
| 19 | + tags: ["그래프", "BFS", "DFS"], |
| 20 | + author: "이알고", |
| 21 | + date: "2023. 5. 17", |
| 22 | + likes: 32, |
| 23 | + comments: 12, |
| 24 | + thumbnail: "https://via.placeholder.com/300x180" |
| 25 | + }, |
| 26 | + { |
| 27 | + title: "동적 프로그래밍 문제 해결 가이드", |
| 28 | + summary: "DP 문제를 효율적으로 푸는 전략과 예제를 모아 정리해봤습니다.", |
| 29 | + tags: ["DP", "문제풀이", "코딩테스트"], |
| 30 | + author: "박코딩", |
| 31 | + date: "2023. 5. 18", |
| 32 | + likes: 40, |
| 33 | + comments: 15, |
| 34 | + thumbnail: "https://via.placeholder.com/300x180" |
| 35 | + } |
| 36 | + ]; |
| 37 | + |
| 38 | + return ( |
| 39 | + <div className="community-container"> |
| 40 | + <div className="community-header"> |
| 41 | + <h1>커뮤니티</h1> |
| 42 | + <button className="new-post-button">+ 새 게시물</button> |
| 43 | + </div> |
| 44 | + |
| 45 | + <div className="popular-posts-wrapper"> |
| 46 | + <h2 className="section-title">🔥 인기 게시물</h2> |
| 47 | + <div className="popular-posts"> |
| 48 | + {posts.slice(0, 3).map((post, idx) => ( |
| 49 | + <div className="popular-post-card" key={idx}> |
| 50 | + <img src={post.thumbnail} alt="썸네일" /> |
| 51 | + <div className="post-text"> |
| 52 | + <h3>{post.title}</h3> |
| 53 | + <p>{post.summary}</p> |
| 54 | + </div> |
| 55 | + <div className="post-meta"> |
| 56 | + <span>{post.author}</span> |
| 57 | + <span>좋아요 {post.likes}</span> |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + ))} |
| 61 | + </div> |
| 62 | + </div> |
| 63 | + |
| 64 | + <div className="search-filter"> |
| 65 | + <input type="text" placeholder="게시물 검색..." /> |
| 66 | + <div className="filter-buttons"> |
| 67 | + <button>최신순</button> |
| 68 | + <button>인기순</button> |
| 69 | + <button>팔로잉</button> |
| 70 | + <button>북마크</button> |
| 71 | + </div> |
| 72 | + </div> |
| 73 | + |
| 74 | + {posts.map((post, idx) => ( |
| 75 | + <div className="post-card" key={idx}> |
| 76 | + <div className="thumbnail-box"> |
| 77 | + <img src={post.thumbnail} alt="썸네일" /> |
| 78 | + </div> |
| 79 | + <div className="post-content"> |
| 80 | + <div className="tags"> |
| 81 | + {post.tags.map((tag, i) => ( |
| 82 | + <span key={i} className="tag">{tag}</span> |
| 83 | + ))} |
| 84 | + </div> |
| 85 | + <h3>{post.title}</h3> |
| 86 | + <p>{post.summary}</p> |
| 87 | + <div className="post-footer"> |
| 88 | + <div className="author-info"> |
| 89 | + <img src="https://via.placeholder.com/32" alt="작성자" /> |
| 90 | + <div> |
| 91 | + <p>{post.author}</p> |
| 92 | + <p className="date">{post.date}</p> |
| 93 | + </div> |
| 94 | + </div> |
| 95 | + <div className="buttons"> |
| 96 | + <button>좋아요 {post.likes}</button> |
| 97 | + <button>댓글 {post.comments}</button> |
| 98 | + <button>공유</button> |
| 99 | + </div> |
| 100 | + </div> |
| 101 | + </div> |
| 102 | + </div> |
| 103 | + ))} |
| 104 | + |
| 105 | + <div className="pagination"> |
| 106 | + <button>◀</button> |
| 107 | + <button className="active">1</button> |
| 108 | + <button>2</button> |
| 109 | + <button>▶</button> |
| 110 | + </div> |
| 111 | + </div> |
| 112 | + ); |
| 113 | +} |
0 commit comments