+
{SELECT_PERMISSION}
-
+
@@ -94,17 +98,31 @@ function PermissionPage() {
/>
}
+ title={MIKE}
+ description={MIKE_DESCRIPTION}
+ />
+
+
+
+ }
title={STORAGE}
description={STORAGE_DESCRIPTION}
/>
-
-
+
{PERMISSION_MESSAGE}
-
+
);
}
diff --git a/src/pages/RegisterLocationCompletePage.jsx b/src/pages/RegisterLocationCompletePage.jsx
new file mode 100644
index 0000000..3490ffe
--- /dev/null
+++ b/src/pages/RegisterLocationCompletePage.jsx
@@ -0,0 +1,26 @@
+import React from 'react';
+import { useNavigate } from 'react-router-dom';
+
+import TextAndBackBar from '../components/common/navBar/TextAndBackBar';
+import LongButton from '../components/common/LongButton';
+import ImageAndMessage from '../components/common/ImageAndMessage';
+
+import { MOVE_TO_HOME, REGISTER_LOCATION_COMPLETE } from '../static/constants';
+
+const RegisterLocationCompletePage = () => {
+ const navigate = useNavigate();
+ const moveToHomePage = () => navigate('/');
+
+ return (
+
+ );
+};
+
+export default RegisterLocationCompletePage;
diff --git a/src/pages/SearchPage.jsx b/src/pages/SearchPage.jsx
index 7ad26c2..ddfc3bf 100644
--- a/src/pages/SearchPage.jsx
+++ b/src/pages/SearchPage.jsx
@@ -3,6 +3,7 @@ import Select from 'react-select';
import SearchBar from '../components/common/navBar/SearchBar';
import SearchedOutputList from '../components/common/SearchedOutputLists';
+import TabBar from '../components/common/navBar/TabBar';
import { ENTER_INPUT, TOTAL_SEARCHED_OUTPUT } from '../static/constants';
@@ -32,6 +33,7 @@ function SearchPage() {
총 {'280,787'}개
+
);
}
diff --git a/src/static/constants.js b/src/static/constants.js
index 7450d5c..d721c87 100644
--- a/src/static/constants.js
+++ b/src/static/constants.js
@@ -21,6 +21,10 @@ const CONFIRM = '확인';
const SEARCH_LOCATION = '내 동네 이름(동,읍,면)으로 검색';
const NEAR_LOCATION = '근처 동네';
+// RegisterLocationCompletePage
+const MOVE_TO_HOME = '홈으로 가기';
+const REGISTER_LOCATION_COMPLETE = '위치등록 완료';
+
// SearchPage
const ENTER_INPUT = '검색어를 입력하세요';
const TOTAL_SEARCHED_OUTPUT = '전체글';
@@ -98,4 +102,6 @@ export {
ACTUAL_PAYMENT_AMOUNT,
JOIN,
EDIT,
+ MOVE_TO_HOME,
+ REGISTER_LOCATION_COMPLETE,
};
From 2d5b3bbbe73648005d852cfaa4fa9704114b5dcb Mon Sep 17 00:00:00 2001
From: Tory <88531407+1two13@users.noreply.github.com>
Date: Wed, 28 Jun 2023 17:34:55 +0900
Subject: [PATCH 3/3] =?UTF-8?q?feat:=20writingPage=20=EA=B8=B0=EB=8A=A5=20?=
=?UTF-8?q?=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/WritingPage.jsx | 201 ++++++++++++++++++++++++++++----------
1 file changed, 147 insertions(+), 54 deletions(-)
diff --git a/src/pages/WritingPage.jsx b/src/pages/WritingPage.jsx
index 04d4879..7c3945c 100644
--- a/src/pages/WritingPage.jsx
+++ b/src/pages/WritingPage.jsx
@@ -1,70 +1,159 @@
import React, { useRef, useState } from 'react';
+import { useDispatch, useSelector } from 'react-redux';
+import { useNavigate } from 'react-router-dom';
+import Select from 'react-select';
import LongButton from '../components/common/LongButton';
import Input from '../components/writingPage/Input';
+import BackButton from '../components/common/navBar/BackButton';
+import { writingSlice } from '../redux/slices/writingSlice';
-import {
- ADD_IMAGE,
- ARTICLE_TITLE,
- CATEGORY,
- TOTAL_AMOUNT,
- MAXIMUM_PEOPLE,
- DESIRED_PLACE,
- PLEASE_WRITE_TEXT,
- DONE,
-} from '../static/constants';
+import { ADD_IMAGE, ARTICLE_TITLE, TOTAL_AMOUNT, MAXIMUM_PEOPLE, PLEASE_WRITE_TEXT, DONE } from '../static/constants';
function WritingPage() {
+ const options = [
+ // TODO: 하드코딩된 값 constants로 추후 변경 예정
+ { value: '전체', label: '전체' },
+ { value: '과일', label: '과일' },
+ { value: '채소', label: '채소' },
+ { value: '쌀/잡곡/견과', label: '쌀/잡곡/견과' },
+ { value: '정육/계란류', label: '정육/계란류' },
+ { value: '수산물/건해산', label: '수산물/건해산' },
+ { value: '우유/유제품', label: '우유/유제품' },
+ { value: '김치/반찬/델리', label: '김치/반찬/델리' },
+ { value: '생수/음료/주류', label: '생수/음료/주류' },
+ { value: '정육/계란류', label: '정육/계란류' },
+ { value: '커피/차/원두', label: '커피/차/원두' },
+ { value: '면류/통조림', label: '면류/통조림' },
+ { value: '양념/오일', label: '양념/오일' },
+ { value: '과자/간식', label: '과자/간식' },
+ { value: '베이커리/잼', label: '베이커리/잼' },
+ { value: '친환경/유기농', label: '친환경/유기농' },
+ ];
+ const min = 1;
+ const max = 4;
+
const imgRef = useRef(null);
- const [count, setCount] = useState(1);
+ const navigate = useNavigate();
+ const dispatch = useDispatch();
+ const title = useSelector((state) => state.writing.title);
+ const imageUrl = useSelector((state) => state.writing.imageUrl);
+ const totalAmount = useSelector((state) => state.writing.totalAmount);
+ const textarea = useSelector((state) => state.writing.textarea);
+
+ const [count, setCount] = useState(min);
+ const [selectedCategory, setSelectedCategory] = useState(options[0]);
const addImages = () => imgRef.current?.click();
- const addImagesHandler = (e) => {};
+ const removeImage = () => dispatch(writingSlice.actions.setImageUrl(null));
+ const onChangeImage = (e) => {
+ const files = e.target.files[0];
+ const reader = new FileReader();
+
+ if (files === undefined) return;
+
+ reader.readAsDataURL(files);
+ reader.onload = () => {
+ dispatch(writingSlice.actions.setImageUrl(reader.result));
+ };
+ };
+
+ const onChangeTitle = (e) => {
+ dispatch(writingSlice.actions.setTitle(e.target.value));
+ };
+
+ const onChangeCategory = (e) => {
+ const selectedValue = e.value;
+ setSelectedCategory(selectedValue);
+ dispatch(writingSlice.actions.setCategory(selectedValue));
+ };
+
+ const onChangeTotalAmount = (e) => {
+ const totalAmount = e.target.value;
+
+ if (!/^[0-9]*$/.test(totalAmount)) e.target.value = '';
+ else dispatch(writingSlice.actions.setTotalAmount(totalAmount));
+ };
+
+ const decreaseCount = () => {
+ const newCount = Math.max(count - 1, min);
+ setCount(newCount);
+ dispatch(writingSlice.actions.setMaxPeople(newCount));
+ };
+ const increaseCount = () => {
+ const newCount = Math.min(count + 1, max);
+ setCount(newCount);
+ dispatch(writingSlice.actions.setMaxPeople(newCount));
+ };
+
+ const onChangeTextarea = (e) => {
+ dispatch(writingSlice.actions.setTextarea(e.target.value));
+ };
+
+ const onclickDoneButton = () => navigate('/posts');
return (
-
-
-
-
-
-
-
+
+
+
+
+
+ {imageUrl ? (
+
+
- {ADD_IMAGE}
-
-
+
+ ) : (
+ ''
+ )}
- {/* TODO: X 버튼 클릭했을 때 사진 제거 */}
-
-
-
-
-
-
-
-
-
{CATEGORY}
+
+
+
+
+
-
-
-
{MAXIMUM_PEOPLE}
-
-
+
+
+
+
{MAXIMUM_PEOPLE}
+
+
-
{count}
-
+ {count}
+
-
-
+ {!title || totalAmount === 0 || !textarea ? (
+
+ ) : (
+
+ )}
);
}