Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into dev_auth
  • Loading branch information
ssssksss committed Sep 22, 2024
2 parents 7e6d33d + 16a33b3 commit 3076db7
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 16 deletions.
26 changes: 19 additions & 7 deletions src/components/common/InformationItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { convertNumberToShortForm } from "@/utils/convertNumberToShortForm";

interface Props {
informationId: number;
categoryId: number;
categoryName: string;
userId?: number;
isBookMark: boolean;
isLike: boolean;
Expand All @@ -20,7 +20,7 @@ interface Props {

const InformationItem = ({
informationId,
categoryId,
categoryName,
userId = 0,
isBookMark,
isLike,
Expand All @@ -32,14 +32,26 @@ const InformationItem = ({
onBookMarkClick,
}: Props) => {
let style = "";
switch (categoryId) {
case 1:
switch (categoryName) {
case "맛집":
case "혼카페":
case "혼밥":
case "혼술":
style = "border-[#FFDDEF] bg-[#FFF2F9] text-[#C5006A]";
break;
case 2:
case "숙박":
case "호텔/펜션":
case "게스트하우스":
case "모텔":
case "홈/빌라":
case "한옥":
style = "border-[#BEEDEA] bg-[#E7FFFB] text-[#009CBE]";
break;
case 3:
case "액티비티":
case "수상레저":
case "관광지":
case "전시":
case "편집/소품샵":
style = "border-[#DDE5FF] bg-[#F2F6FF] text-[#0036C2]";
break;
default:
Expand All @@ -63,7 +75,7 @@ const InformationItem = ({
<p
className={`w-fit rounded-full border-[0.0625rem] px-4 py-[0.375rem] text-xs font-semibold ${style}`}
>
{CATEGORY_TEXT[categoryId]}
{categoryName}
</p>
) : (
<div />
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/BestInformationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const BestInformationList = async () => {
<InformationItemContainer
key={index}
informationId={value.informationId}
categoryId={Number(CATEGORY_TEXT[value.parentCategoryName])}
categoryName={value.parentCategoryName}
isBookMark={value.isBookMark}
isLike={value.isLike}
title={value.title}
Expand Down
2 changes: 1 addition & 1 deletion src/components/informations/detail/RecommendationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const RecommendationList = ({ data }: Props) => {
<InformationItemContainer
key={index}
informationId={index + 1}
categoryId={0}
categoryName={value.categoryName}
isBookMark={value.isBookMark}
isLike={value.isLike}
title={value.title}
Expand Down
2 changes: 1 addition & 1 deletion src/components/informations/list/InformationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const InformationList = async ({
<InformationItemContainer
key={value.informationId}
informationId={value.informationId}
categoryId={parentCategoryId}
categoryName={value.categoryName}
isBookMark={value.isBookMark}
isLike={value.isLike}
title={value.title}
Expand Down
2 changes: 1 addition & 1 deletion src/components/mypage/MyBookmarkList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const MyBookmarkList = ({ data }: MyBookmarkListProps) => {
<InformationItemContainer
key={"post" + post.id}
informationId={post.id}
categoryId={1}
categoryName={post.category}
isBookMark={true}
isLike={false} // TODO: 수정 필요
title={post.title}
Expand Down
3 changes: 1 addition & 2 deletions src/components/mypage/MyPageInformationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const MyPageInformationList = ({
elements,
isLoading,
}: IMyPageInformationList) => {

return (
<div className="flex w-full flex-col">
<div className="mt-6 grid grid-cols-3 gap-5 max-[1024px]:grid-cols-2 max-[744px]:grid-cols-1">
Expand All @@ -33,7 +32,7 @@ const MyPageInformationList = ({
<InformationItemContainer
key={value.informationId}
informationId={value.informationId}
categoryId={0}
categoryName={value.zoneCategoryParentName}
isBookMark={value.isBookMark}
isLike={false}
title={value.title}
Expand Down
6 changes: 3 additions & 3 deletions src/containers/common/InformationItemContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useState } from "react";

interface Props {
informationId: number;
categoryId: number;
categoryName: string;
isBookMark: boolean;
isLike: boolean;
title: string;
Expand All @@ -19,7 +19,7 @@ interface Props {

const InformationItemContainer = ({
informationId,
categoryId,
categoryName,
isBookMark,
isLike,
title,
Expand Down Expand Up @@ -85,7 +85,7 @@ const InformationItemContainer = ({
return (
<InformationItem
informationId={informationId}
categoryId={categoryId}
categoryName={categoryName}
userId={userId}
isBookMark={isBookMarked}
isLike={isLike}
Expand Down
2 changes: 2 additions & 0 deletions src/types/InformationDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export interface InformationListResponseDto {
title: string;
zoneCategoryParentName: string;
zoneCategoryChildName: string;
categoryName: string;
viewCount: number;
isBookMark: boolean;
thumbNailImage: string;
Expand Down Expand Up @@ -119,6 +120,7 @@ export interface InformationDetailDto {
title: string;
zoneCategoryParentName: string;
zoneCategoryChildName: string;
categoryName: string;
viewCount: number;
isBookMark: boolean;
isLike: boolean;
Expand Down

0 comments on commit 3076db7

Please sign in to comment.