diff --git a/public/icons/heart.svg b/public/icons/heart.svg index 40bec30..c686a17 100644 --- a/public/icons/heart.svg +++ b/public/icons/heart.svg @@ -1,9 +1 @@ - + \ No newline at end of file diff --git a/public/icons/red_haert.svg b/public/icons/red_haert.svg deleted file mode 100644 index c22752a..0000000 --- a/public/icons/red_haert.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/icons/red_heart.svg b/public/icons/red_heart.svg new file mode 100644 index 0000000..96b98c5 --- /dev/null +++ b/public/icons/red_heart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/common/LikesPost/LikesPost.module.scss b/src/components/common/LikesPost/LikesPost.module.scss new file mode 100644 index 0000000..1cd2229 --- /dev/null +++ b/src/components/common/LikesPost/LikesPost.module.scss @@ -0,0 +1,42 @@ +.Box { + width: 100%; + padding: 2rem; + @include flexSort(null, space-between, center, null); + border: 1px solid #9d9d9d; + border-radius: 2rem; + box-shadow: 0 0.4rem 0.4rem 0 rgba(0, 0, 0, 0.25); + + &:hover { + background-color: $gray-3; + } +} + +.leftBox { + @include flexSort(column, null, null, 1rem); +} + +.titleBox { + @include flexSort(null, null, center, 2rem); +} + +.title { + @include font(2rem, 600, normal); +} + +.dateBox { + @include flexSort(null, null, center, 1rem); + @include font(1.3rem, 300, normal); +} + +.rightBox { + @include flexSort(column, null, flex-end, 1rem); +} + +.detailBtn { + padding: 0.7rem 1rem; + border-radius: 1rem; + background: #8b8282; + color: white; + @include font(1.3rem, 600, normal); + @include flexSort(null, center, center, null); +} diff --git a/src/components/common/LikesPost/LikesPost.tsx b/src/components/common/LikesPost/LikesPost.tsx new file mode 100644 index 0000000..b7e09ef --- /dev/null +++ b/src/components/common/LikesPost/LikesPost.tsx @@ -0,0 +1,42 @@ +import classNames from "classnames/bind"; + +import Link from "next/link"; + +import { ROUTE } from "@/constants/route"; +import RedHeart from "@/icons/red_heart.svg"; +import { formatDateString } from "@/utils"; + +import styles from "./LikesPost.module.scss"; +import PostStatusLabel from "../PostStatusLabel/PostStatusLabel"; + +const cn = classNames.bind(styles); + +interface LikesPostProps { + id: number; + title: string; + postStatus: "RECRUITING" | "FINISHED"; + modifiedAt: string; + endTime: string; + postType: "TAKER" | "GIVER"; +} + +export default function LikesPost({ endTime, id, modifiedAt, postStatus, title, postType }: LikesPostProps) { + return ( + +
{`#${id} ${title}`}
+일시 |
+{`${formatDateString(modifiedAt)} ~ ${formatDateString(endTime)}`}
+{title}
diff --git a/src/components/common/Post/apis/postLikes.ts b/src/components/common/Post/apis/postLikes.ts new file mode 100644 index 0000000..dcc2569 --- /dev/null +++ b/src/components/common/Post/apis/postLikes.ts @@ -0,0 +1,12 @@ +import axiosInstance from "@/apis/axiosInstance"; + +export default async function postLikes(postId: number) { + const { data } = await axiosInstance.post( + `posts/likes/${postId}`, + {}, + { + withCredentials: true, + }, + ); + return data; +} diff --git a/src/components/common/PostStatusLabel/PostStatusLabel.module.scss b/src/components/common/PostStatusLabel/PostStatusLabel.module.scss new file mode 100644 index 0000000..1157c25 --- /dev/null +++ b/src/components/common/PostStatusLabel/PostStatusLabel.module.scss @@ -0,0 +1,23 @@ +.box { + @include flexSort(null, center, center, null); + border-radius: 1rem; + padding: 0.5rem 1rem; + border: 0.1rem solid #ff6767; + @include font(1.2rem, 500, normal); + + &.RECRUITING { + background-color: white; + + .statusText { + color: #ff6767; + } + } + + &.FINISHED { + background-color: #ff6767; + + .statusText { + color: white; + } + } +} diff --git a/src/components/common/PostStatusLabel/PostStatusLabel.tsx b/src/components/common/PostStatusLabel/PostStatusLabel.tsx new file mode 100644 index 0000000..9890780 --- /dev/null +++ b/src/components/common/PostStatusLabel/PostStatusLabel.tsx @@ -0,0 +1,19 @@ +import classNames from "classnames/bind"; + +import styles from "./PostStatusLabel.module.scss"; + +const cn = classNames.bind(styles); + +interface PostStatusLabelProps { + postStatus: "RECRUITING" | "FINISHED"; +} + +export default function PostStatusLabel({ postStatus }: PostStatusLabelProps) { + const statusText = postStatus === "RECRUITING" ? "매칭중" : "매칭완료"; + + return ( +{statusText}
+찜한 목록
+