diff --git a/src/App.tsx b/src/App.tsx index a45430c..f976809 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,6 +12,7 @@ import styled from "styled-components"; import WritingPage from "./pages/writing/WritingPage"; import Testpage from "./pages/Testpage"; import EditPage from "./pages/writing/EditPage"; +import HashtagDetail from "./pages/collection/HashtagDetail"; function App() { return ( @@ -29,6 +30,7 @@ function App() { } /> } /> + } /> } /> diff --git a/src/components/diary/Header.tsx b/src/components/diary/Header.tsx index 9d8ccf6..38dbf35 100644 --- a/src/components/diary/Header.tsx +++ b/src/components/diary/Header.tsx @@ -1,3 +1,84 @@ -const Header = () => {}; +import styled from "styled-components"; +import { + IoChevronBack, + IoChevronForward, + IoHomeOutline, +} from "react-icons/io5"; +import { useNavigate } from "react-router-dom"; + +interface HeaderProps { + characterList: string[]; + currentIndex: number; + setCurrentIndex: React.Dispatch>; +} + +const Header = ({ + characterList, + currentIndex, + setCurrentIndex, +}: HeaderProps) => { + const navigate = useNavigate(); + + const goPrev = () => { + setCurrentIndex( + (prev) => (prev - 1 + characterList.length) % characterList.length, + ); + }; + + const goNext = () => { + setCurrentIndex((prev) => (prev + 1) % characterList.length); + }; + + return ( + + navigate("/")} /> + + + + + + {characterList[currentIndex]} + + + + + + + + ); +}; export default Header; + +const HeaderWrapper = styled.div` + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 20px; +`; + +const CenterContainer = styled.div` + position: absolute; + left: 50%; + transform: translateX(-50%); + width: 160px; + display: flex; + align-items: center; + justify-content: space-between; + color: #2d3552; + font-weight: 500; + font-size: 1.2rem; +`; + +const Name = styled.span` + flex: 1; + text-align: center; +`; + +const Placeholder = styled.div` + width: 28px; +`; + +const ClickableIcon = styled.div` + cursor: pointer; +`; diff --git a/src/components/home/DiaryList.tsx b/src/components/home/DiaryList.tsx index 1735393..1902116 100644 --- a/src/components/home/DiaryList.tsx +++ b/src/components/home/DiaryList.tsx @@ -93,13 +93,19 @@ export const DiaryTitle = styled.div` export const TagWrapper = styled.div` display: flex; - gap: 8px; - font-size: 14px; - color: #3b82f6; + flex-wrap: nowrap; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; margin-bottom: 8px; `; -export const Tag = styled.span``; +export const Tag = styled.span` + font-size: 14px; + color: #3b82f6; + margin-right: 8px; + flex-shrink: 0; +`; export const Content = styled.div` font-size: 14px; diff --git a/src/pages/DiaryDetail.tsx b/src/pages/DiaryDetail.tsx index 4cffa36..27f914f 100644 --- a/src/pages/DiaryDetail.tsx +++ b/src/pages/DiaryDetail.tsx @@ -169,13 +169,13 @@ const Title = styled.h2` border-radius: 8px; `; -const TagBox = styled.div` +export const TagBox = styled.div` display: flex; gap: 8px; flex-wrap: wrap; `; -const Tag = styled.span` +export const Tag = styled.span` background: #ffffff; color: #2563eb; padding: 6px 12px; diff --git a/src/pages/collection/Comments.tsx b/src/pages/collection/Comments.tsx index ee47c76..3883190 100644 --- a/src/pages/collection/Comments.tsx +++ b/src/pages/collection/Comments.tsx @@ -9,13 +9,7 @@ import { StarIcon, StarIconFill, } from "../DiaryDetail"; -import styled from "styled-components"; -import { - IoChevronBack, - IoChevronForward, - IoHomeOutline, -} from "react-icons/io5"; -import { useNavigate } from "react-router-dom"; +import Header from "../../components/diary/Header"; const dummyComments = [ "오랜만에 영화관에서 좋은 시간 보냈다니 내가 다 기쁘다! 너의 여유로운 하루가 참 따뜻하게 느껴져 :)", @@ -23,44 +17,22 @@ const dummyComments = [ "새로운 도전을 했다는 말에 나도 힘이 나! 계속 응원할게 :)", ]; +const characterList = ["웅이", "앙글이", "티바노"]; + const Comments = () => { const [starred, setStarred] = useState( new Array(dummyComments.length).fill(false), ); const [currentIndex, setCurrentIndex] = useState(0); - const navigate = useNavigate(); - - const goPrev = () => { - setCurrentIndex( - (prev) => (prev - 1 + characterList.length) % characterList.length, - ); - }; - - const goNext = () => { - setCurrentIndex((prev) => (prev + 1) % characterList.length); - }; return ( - - navigate("/")} - /> - - - - - - {characterList[currentIndex]} - - - - +
- -
즐겨찾기 한 코멘트 목록
{dummyComments.map((comment, index) => ( @@ -93,38 +65,3 @@ const Comments = () => { }; export default Comments; - -const characterList = ["웅이", "앙글이", "티바노"]; - -const HeaderWrapper = styled.div` - display: flex; - align-items: center; - justify-content: space-between; - margin-bottom: 20px; -`; - -const CenterContainer = styled.div` - position: absolute; - left: 50%; - transform: translateX(-50%); - width: 160px; /* 고정 너비로 좌우 아이콘 위치 유지 */ - display: flex; - align-items: center; - justify-content: space-between; - color: #2d3552; - font-weight: 500; - font-size: 1.2rem; -`; - -const Name = styled.span` - flex: 1; - text-align: center; -`; - -const Placeholder = styled.div` - width: 28px; /* 오른쪽 균형용 */ -`; - -const ClickableIcon = styled.div` - cursor: pointer; -`; diff --git a/src/pages/collection/HashtagDetail.tsx b/src/pages/collection/HashtagDetail.tsx new file mode 100644 index 0000000..b86d958 --- /dev/null +++ b/src/pages/collection/HashtagDetail.tsx @@ -0,0 +1,32 @@ +import { useState } from "react"; +import Header from "../../components/diary/Header"; +import { Body } from "../DiaryDetail"; +import DiaryList from "../../components/home/DiaryList"; +import { TheFooter } from "../../components/common/TheFooter"; + +const characterList = [ + "슬픔", + "행복", + "기쁨", + "사랑", + "우정", + "추억", + "여행", + "일상", + "꿈", +]; + +const HashtagDetail = () => { + const [currentIndex, setCurrentIndex] = useState(0); + return ( + +
+ + + ); +}; +export default HashtagDetail; diff --git a/src/pages/collection/Hashtags.tsx b/src/pages/collection/Hashtags.tsx index e8e96d1..12afc32 100644 --- a/src/pages/collection/Hashtags.tsx +++ b/src/pages/collection/Hashtags.tsx @@ -1,9 +1,23 @@ +import { IoHomeOutline } from "react-icons/io5"; +import { Body, Tag, TagBox } from "../DiaryDetail"; +import { useNavigate } from "react-router-dom"; + +const dummyHashtags = Array.from({ length: 50 }, (_, i) => `더미태그${i + 1}`); + const Hashtags = () => { + const navigate = useNavigate(); return ( - <> - <>Hashtags -

일단 없는 걸로

- + + navigate("/")} /> +
해시태그 목록
+ + {dummyHashtags.map((tag, idx) => ( + navigate(`/hashtag/${(idx + 1).toString()}`)}> + #{tag} + + ))} + + ); }; export default Hashtags;