-
- {data.account_name}
- 한도계좌
-
-
- 입출금 {data.account_number}
- 복사
-
-
- {data.balance.toLocaleString()}
- 원
-
-
-
diff --git a/src/pages/openLesson/RegisterLesson.tsx b/src/pages/openLesson/RegisterLesson.tsx
index af16a64..dd6a1c8 100644
--- a/src/pages/openLesson/RegisterLesson.tsx
+++ b/src/pages/openLesson/RegisterLesson.tsx
@@ -1,7 +1,7 @@
import { useNavigate } from 'react-router-dom';
import { Topbar } from '../../components/common/Topbar';
import { Button } from '../../components/common/Button';
-import { ChangeEvent, useRef, useState } from 'react';
+import { ChangeEvent, useEffect, useRef, useState } from 'react';
import { CompleteSend } from '../../components/organisms/CompleteSend';
import { FaCamera } from 'react-icons/fa';
import { SelectAddress } from '../../components/molecules/SelectAddress';
@@ -50,7 +50,6 @@ export const RegisterLesson = () => {
const file = e.target.files[0];
const imageUrl = URL.createObjectURL(file);
setUploadImageFile(imageUrl);
- checkValid();
// const formData = new FormData();
// if (file) {
// formData.append('file', file);
@@ -62,23 +61,19 @@ export const RegisterLesson = () => {
const onChangeCategory = (category: string) => {
setCategory(category);
setShowModal(false);
- checkValid();
};
const onChangeLessonTime = (lessontime: LessonTime[]) => {
setLessonTime(lessontime);
- checkValid();
};
const onChangeMaterials = (materials: string) => {
setMaterials(materials);
- checkValid();
};
const onChangeAddress = (address: string) => {
if (address && address.length !== 1) {
setAddress(address);
- checkValid();
}
};
@@ -96,6 +91,14 @@ export const RegisterLesson = () => {
setIsBtnActive(false);
return;
}
+ if (inputPrice.current && +inputPrice.current.value <= 0) {
+ setIsBtnActive(false);
+ return;
+ }
+ if (inputCapacity.current && +inputCapacity.current.value <= 0) {
+ setIsBtnActive(false);
+ return;
+ }
setIsBtnActive(true);
};
@@ -113,6 +116,10 @@ export const RegisterLesson = () => {
setIsSend(true);
};
+ useEffect(() => {
+ checkValid();
+ }, [uploadImageFile, category, lessonTime, materials, address]);
+
return (
<>
{showModal && (
@@ -169,7 +176,7 @@ export const RegisterLesson = () => {
type='text'
title='강좌명'
placeholder='강좌명을 입력해주세요.(최대 50자)'
- onChange={checkValid}
+ onChange={() => checkValid()}
ref={inputTitle}
/>
@@ -186,14 +193,14 @@ export const RegisterLesson = () => {
type='number'
title='모집인원'
placeholder='모집인원을 입력해주세요.'
- onChange={checkValid}
+ onChange={() => checkValid()}
ref={inputCapacity}
/>
checkValid()}
ref={inputPrice}
/>
@@ -204,7 +211,7 @@ export const RegisterLesson = () => {
ref={inputDetailInfo}
placeholder='상세 설명을 입력해주세요. (200자 이내)'
maxLength={200}
- onChange={checkValid}
+ onChange={() => checkValid()}
className='w-full h-36 rounded-md border-[0.7px] border-hanaSilver text-xs placeholder:text-hanaSilver p-3 focus:outline-none'
>
diff --git a/src/pages/search/PayLesson.tsx b/src/pages/search/PayLesson.tsx
index 0d01a19..abdb02c 100644
--- a/src/pages/search/PayLesson.tsx
+++ b/src/pages/search/PayLesson.tsx
@@ -88,8 +88,10 @@ export const PayLesson = () => {
onClose={() => setShowModal(false)}
>
- {state.payment}원
- 결제합니다.
+
+ {state.payment.toLocaleString()}
+
+ 원 결제합니다.
diff --git a/src/utils/scrollToTop.ts b/src/utils/scrollToTop.ts
new file mode 100644
index 0000000..4b224ef
--- /dev/null
+++ b/src/utils/scrollToTop.ts
@@ -0,0 +1,12 @@
+import { useEffect } from 'react';
+import { useLocation } from 'react-router-dom';
+
+export const ScrollToTop = () => {
+ const { pathname } = useLocation();
+
+ useEffect(() => {
+ window.scrollTo(0, 0);
+ }, [pathname]);
+
+ return null;
+};