diff --git a/src/components/Trade/Board/index.tsx b/src/components/Trade/Board/index.tsx index 2e662d3..1f2762e 100644 --- a/src/components/Trade/Board/index.tsx +++ b/src/components/Trade/Board/index.tsx @@ -2,13 +2,14 @@ import { useEffect, useRef, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import dayjs from 'dayjs'; import { RentalType, TradeBoardType } from '@/types/Board/tradeType'; -import { convertRentalTypeName, priceCount } from '@/utils/utils'; +import { convertRentalTypeName, getHouseName, priceCount } from '@/utils/utils'; import styles from './styles.module.scss'; type TradeBoardProps = Omit; export default function TradeBoard({ houseId, + houseType, rentalType, city, price, @@ -97,7 +98,9 @@ export default function TradeBoard({ )}
-

{title}

+

+ [{getHouseName(houseType)}] {title} +

위치 : {city}

diff --git a/src/components/Trade/Info/index.tsx b/src/components/Trade/Info/index.tsx index d78ddf2..8f1f74e 100644 --- a/src/components/Trade/Info/index.tsx +++ b/src/components/Trade/Info/index.tsx @@ -1,6 +1,6 @@ import dayjs from 'dayjs'; import { TradeBoardDetailType } from '@/types/Board/tradeType'; -import { getRentalName } from '@/utils/utils'; +import { getHouseName, getRentalName } from '@/utils/utils'; import styles from './styles.module.scss'; // TODO: undefined 처리하기 @@ -12,28 +12,13 @@ function TradeBoardInfo({ info }: TradeBoardInfoProps) { return (
- 기본정보 -
- 위치

{info?.city}

-
-
- 면적{' '} -

- {info?.size}m2 -

-
-
- 용도

{info?.purpose}

-
+ 임대정보 및 판매자 정보
- 준공연도

{dayjs(info?.createdDate).format('YYYY')}년

+ 유형

{info?.houseType && getHouseName(info?.houseType)}

- 층수

{info?.floorNum === 0 ? '-' : `${info?.floorNum}층`}

+ 위치

{info?.city}

-
-
- 임대정보 및 판매자 정보
가격{' '}

@@ -50,6 +35,18 @@ function TradeBoardInfo({ info }: TradeBoardInfoProps) {

)}
+
+ 기본정보 +
+ 면적

{info?.size}㎡

+
+
+ 준공연도

{dayjs(info?.createdDate).format('YYYY')}년

+
+
+ 용도

{info?.purpose}

+
+
); } diff --git a/src/pages/Trade/Board/index.tsx b/src/pages/Trade/Board/index.tsx index c933a1f..21c6746 100644 --- a/src/pages/Trade/Board/index.tsx +++ b/src/pages/Trade/Board/index.tsx @@ -23,7 +23,7 @@ import { DeleteHouseAPI } from '@/apis/houses'; import userStore from '@/store/userStore'; import useModalState from '@/hooks/useModalState'; import useToastMessageType from '@/hooks/useToastMessageType'; -import { getMoveInType, getUserType } from '@/utils/utils'; +import { getHouseName, getMoveInType, getUserType } from '@/utils/utils'; import { ApiResponseWithDataType } from '@/types/apiResponseType'; import { opacityVariants } from '@/constants/variants'; import styles from './styles.module.scss'; @@ -104,7 +104,10 @@ export default function TradeBoardPage() { {getUserType(data?.data.userType || 'NONE')} -

{data?.data.title}

+

+ {data?.data.houseType && `[${getHouseName(data?.data.houseType)}]`}{' '} + {data?.data.title} +

{data?.data.nickName} diff --git a/src/pages/Trade/index.tsx b/src/pages/Trade/index.tsx index 50b25a5..8574be3 100644 --- a/src/pages/Trade/index.tsx +++ b/src/pages/Trade/index.tsx @@ -124,6 +124,7 @@ export default function TradePage() { { } }; +// 매매 타입 이름 가져오기 +export const getHouseName = (house: HouseType) => { + switch (house) { + case 'LAND': + return '토지'; + case 'HOUSE': + return '주택'; + case 'FARM_HOUSE': + return '농가'; + default: + return ''; + } +}; + // 매매 타입 이름 가져오기 export const getRentalName = (rental: RentalType) => { switch (rental) {