Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/ODOICHON/frontend into f…
Browse files Browse the repository at this point in the history
…eat/#285
  • Loading branch information
sangminlee98 committed Aug 18, 2024
2 parents f927416 + 0c3cefc commit 0f46d9c
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 27 deletions.
75 changes: 58 additions & 17 deletions src/pages/Trade/Write/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { motion } from 'framer-motion';
import AddressModal from '@/components/Trade/AddressModal';
import TradeQuill from '@/components/Trade/Quill';
import {
HouseType,
RentalType,
TradeBoardDetailType,
TradeBoardForm,
Expand All @@ -16,7 +17,11 @@ import { imageStore } from '@/store/imageStore';
import userStore from '@/store/userStore';
import { getRentalPriceType } from '@/utils/utils';
// import { DEFAULT_OPTIONS } from '@/constants/image';
import { specialCategory, tradeCategory } from '@/constants/trade';
import {
houseCategory,
specialCategory,
tradeCategory,
} from '@/constants/trade';
import { opacityVariants } from '@/constants/variants';
import styles from './styles.module.scss';

Expand All @@ -30,6 +35,7 @@ export default function TradeWritePage() {
const { state }: { state: { data: TradeBoardDetailType } } = useLocation();

const [form, setForm] = useState<TradeBoardForm>({
houseType: state ? state.data.houseType : 'LAND',
rentalType: state ? state.data.rentalType : 'SALE',
city: state ? state.data.city : '',
zipCode: state ? state.data.zipCode : '',
Expand Down Expand Up @@ -133,7 +139,35 @@ export default function TradeWritePage() {
<p>해당 정보는 필수로 입력해야 하는 값입니다.</p>
<div>
<div>
<label>매물 유형</label>
<label>
매물 유형<span className={styles.essential}>*</span>
</label>
<ul>
{houseCategory.slice(1).map((item) => (
<button
key={item.type}
type="button"
className={
form.houseType === item.type
? styles.selectRentalType
: styles.rentalType
}
onClick={() => {
setForm((prev: TradeBoardForm) => ({
...prev,
houseType: item.type as HouseType,
}));
}}
>
{item.content}
</button>
))}
</ul>
</div>
<div>
<label>
거래 형태<span className={styles.essential}>*</span>
</label>
<ul>
{tradeCategory.slice(1).map((item) => (
<button
Expand All @@ -157,7 +191,9 @@ export default function TradeWritePage() {
</ul>
</div>
<div>
<label htmlFor="메인 사진">메인 사진</label>
<label htmlFor="메인 사진">
메인 사진<span className={styles.essential}>*</span>
</label>
<input
id="메인 사진"
type="text"
Expand Down Expand Up @@ -185,7 +221,9 @@ export default function TradeWritePage() {
</button>
</div>
<div>
<label htmlFor="매물 위치">매물 위치</label>
<label htmlFor="매물 위치">
매물 위치<span className={styles.essential}>*</span>
</label>
<input
id="매물 위치"
type="text"
Expand Down Expand Up @@ -219,7 +257,9 @@ export default function TradeWritePage() {
/>
</div>
<div>
<label htmlFor="상세주소">상세주소</label>
<label style={{ visibility: 'hidden' }} htmlFor="상세주소">
상세주소
</label>
<input
id="상세주소"
type="text"
Expand All @@ -232,6 +272,7 @@ export default function TradeWritePage() {
<div>
<label htmlFor="임대 가격">
{getRentalPriceType(form.rentalType)}
<span className={styles.essential}>*</span>
</label>
<input
id="임대 가격"
Expand All @@ -258,7 +299,9 @@ export default function TradeWritePage() {
/>
</div>
<div>
<label htmlFor="전화번호">전화번호</label>
<label htmlFor="전화번호">
전화번호<span className={styles.essential}>*</span>
</label>
<input
id="전화번호"
type="text"
Expand All @@ -270,7 +313,9 @@ export default function TradeWritePage() {
</div>
{user?.userType === 'AGENT' && (
<div>
<label htmlFor="공인중개사명">공인중개사명</label>
<label htmlFor="공인중개사명">
공인중개사명<span className={styles.essential}>*</span>
</label>
<input
id="공인중개사명"
type="text"
Expand All @@ -289,21 +334,19 @@ export default function TradeWritePage() {
<div>
<div>
<label htmlFor="매물 면적">
매물 면적<span>*</span>
매물 면적<span className={styles.essential}>*</span>
</label>
<input
id="매물 면적"
type="text"
placeholder="m2로 표기"
placeholder="㎡로 표기"
name="size"
value={form.size}
onChange={onChangeForm}
/>
</div>
<div>
<label htmlFor="준공연도">
준공연도<span>*</span>
</label>
<label htmlFor="준공연도">준공연도</label>
<input
id="준공연도"
type="text"
Expand All @@ -314,9 +357,7 @@ export default function TradeWritePage() {
/>
</div>
<div>
<label htmlFor="매물 용도">
매물 용도<span>*</span>
</label>
<label htmlFor="매물 용도">매물 용도</label>
<input
id="매물 용도"
type="text"
Expand All @@ -326,7 +367,7 @@ export default function TradeWritePage() {
onChange={onChangeForm}
/>
</div>
<div>
{/* <div>
<label htmlFor="층수">층수</label>
<input
id="층수"
Expand All @@ -336,7 +377,7 @@ export default function TradeWritePage() {
value={form.floorNum}
onChange={onChangeForm}
/>
</div>
</div> */}
</div>
</article>
<article className={styles.specialInfoContainer}>
Expand Down
4 changes: 4 additions & 0 deletions src/pages/Trade/Write/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@
border-color: var(--main-color);
}

.essential{
color: var(--main-color);
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
Expand Down
1 change: 1 addition & 0 deletions src/types/Board/tradeType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type MenuType = 'none' | 'houseType' | 'rentalType' | 'city' | 'search';
export type DealStateType = 'APPLYING' | 'ONGOING' | 'COMPLETED';

export type TradeBoardForm = {
houseType: HouseType;
rentalType: RentalType;
city: string;
zipCode: string;
Expand Down
11 changes: 1 addition & 10 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ export const checkBeforeTradePost = (
contact,
agentName,
size,
floorNum,
createdDate,
purpose,
title,
code,
Expand Down Expand Up @@ -202,14 +200,7 @@ export const checkBeforeTradePost = (
alert('평수를 입력해주세요.');
return false;
}
if (floorNum < 0) {
alert('1층 이상의 값만 작성해주세요.');
return false;
}
if (createdDate === '') {
alert('준공일을 입력해주세요.');
return false;
}

if (purpose === '') {
alert('용도를 입력해주세요.');
return false;
Expand Down

0 comments on commit 0f46d9c

Please sign in to comment.