Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: 돌보미 정보 careSize 수정 후 반영 안되던 현상 수정 #381

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 19 additions & 13 deletions src/page/Detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ const Detail = ({socket}) => {
'noPets': '등록된 반려견 정보가 없습니다.',
}
const [errorMessage, setErrorMessage] = useState(null);
const detailPageRef = useRef();
const reservationRef = useRef();
const careSizeRef = useRef();
const plusService = useRef();
const reviewRef = useRef();
const pageBodyRef = useRef();
const floatingTabsRef = useRef();
const selectAreaRef = useRef();
const [modalDisplay, setModalDisplay] = useState(false)
const [scrollY, setScrollY] = useState();
const [scrollDirection, setScrollDirection] = useState();
Expand Down Expand Up @@ -239,14 +239,14 @@ const Detail = ({socket}) => {
}else{
datesTransformed.current = [];
}
selectAreaRef.current?.classList.add('isActive');
detailPageRef.current?.classList.add('menuIsActive');
}, [date]);

useEffect(()=>{
if(scrollDirection === 'up'){
selectAreaRef.current?.classList.add('isActive');
detailPageRef.current?.classList.add('menuIsActive');
}else{
selectAreaRef.current?.classList.remove('isActive');
detailPageRef.current?.classList.remove('menuIsActive');
}
setSelectBoxToggle({ type: "", status: false });
},[scrollDirection])
Expand All @@ -272,7 +272,7 @@ const Detail = ({socket}) => {
if (!detail) return null;
return (
<>
<SitterDetailPage className="detailPageWrap" style={{paddingTop: 0}} onScroll={(e)=>{
<SitterDetailPage ref={detailPageRef} className="detailPageWrap" style={{paddingTop: 0}} onScroll={(e)=>{
scrollEvent(e);
setScrollY((prev)=>{
if (prev > e.target.scrollTop) setScrollDirection('up');
Expand Down Expand Up @@ -349,7 +349,7 @@ const Detail = ({socket}) => {
new_data[i] = e.target.checked;
return new_data;
});
selectAreaRef.current.classList.add('isActive');
detailPageRef.current.classList.add('menuIsActive');
}}/>
<span>
<i className={iconClasses[v]}></i>
Expand Down Expand Up @@ -444,7 +444,7 @@ const Detail = ({socket}) => {
)
}
</section>
<section>
<section className="location_section">
<h3>{detail.sitter.sitterName}님의 위치</h3>
<MapWrapper>
<MapContainer
Expand All @@ -457,7 +457,7 @@ const Detail = ({socket}) => {
</section>
</section>
<ReservationFunctions>
<div className="select_area" ref={selectAreaRef}>
<div className="select_area">
<div className={`select_detail service ${selectBoxToggle.status && selectBoxToggle.type === "service" ? 'isShow' : ''}`}>
<h3>서비스 선택 <button type="button" className="closeSelectWrap" onClick={()=>setSelectBoxToggle({status: false, type: null})}>닫기</button></h3>
<div>
Expand Down Expand Up @@ -615,7 +615,7 @@ const Detail = ({socket}) => {
</Modal>
)}
{(modalDisplay && errorMessage !== errorMessages.notLogin && errorMessage !== errorMessages.noPets ) && (
<Modal _display={modalDisplay} _alert={true} confirmOnClick={()=>{setErrorMessage(null); setModalDisplay(false); selectAreaRef.current.classList.add('isActive');}}>
<Modal _display={modalDisplay} _alert={true} confirmOnClick={()=>{setErrorMessage(null); setModalDisplay(false); detailPageRef.current.classList.add('menuIsActive');}}>
<div className="text_area">
<p>{errorMessage}</p>
</div>
Expand Down Expand Up @@ -764,11 +764,8 @@ const ReservationFunctions = styled.div`
left: 0;
right: 0;
bottom: 100%;
transform: translateY(100%);
transition: ease-out 240ms;
&.isActive{
transform: translateY(0);
}
transform: translateY(100%);
& > ul {
position: relative;
z-index: 2;
Expand Down Expand Up @@ -832,6 +829,15 @@ const SitterDetailPage = styled.div`
overflow: hidden;
overflow-y: auto;
line-height: 1.4;
//여기
&.menuIsActive{
.location_section{
margin-bottom: 200px;
}
.select_area{
transform: translateY(0);
}
}
& > section {
&.page_top{
section{
Expand Down
22 changes: 12 additions & 10 deletions src/page/SitterProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,18 @@ const SitterProfile = () => {
<label className="tit">케어 가능 범위</label>
<CheckGroup>
{values.careSize.map((el, idx) => {
return(
<Checkbox
_text={idx === 0 ? "소형견" : idx === 1 ? "중형견" : "대형견"}
_size={"1.2rem"}
_border={"1px solid rgba(120, 120, 120, 0.7)"}
_id={idx === 0 ? "소형견" : idx === 1 ? "중형견" : "대형견"}
checked={idx === 0 && el ? "소형견" : idx === 1 && el ? "중형견" : idx === 2 && el ? "대형견" : ""}
disabled
/>
)
if(el){
return(
<Checkbox
key={idx}
_text={idx === 0 ? "소형견" : idx === 1 ? "중형견" : "대형견"}
_size={"1.2rem"}
_id={idx === 0 ? "소형견" : idx === 1 ? "중형견" : "대형견"}
checked={idx === 0 && el ? "소형견" : idx === 1 && el ? "중형견" : idx === 2 && el ? "대형견" : ""}
hayeooooon marked this conversation as resolved.
Show resolved Hide resolved
disabled
/>
)
}
})}

{/* <Checkbox
Expand Down