-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AUD-115] 코스 내 장소 순서 변경, 장소 이름 변경 기능 연동 (#70)
* ✨ 코스 이름 수정 모달 추가, 순서 변경 로직 추가 * ✨ marker 관련 커스텀 이벤트 타입 추가 * ✨ 핀 장소 명 수정 모달 및 기능 연동 * 🐛 console.log 제거 * 🚑 유저 접속 시 접속자 목록에 표기되도록 수정 * 🐛 경로 그리기 기능 일부 수정 * ✨ 코스 순서 변경 기능 적용 * 🐛 Eslint 에서 지적한 에러 수정
- Loading branch information
Showing
17 changed files
with
428 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/features/path/path-name-edit-modal/PathNameEditModal.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
import { recipe } from '@vanilla-extract/recipes'; | ||
|
||
import { COLOR } from '@/styles/foundation'; | ||
import { sprinkles } from '@/styles/sprinkle.css'; | ||
|
||
export const modalHeader = style({ | ||
width: '100%', | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
}); | ||
|
||
export const couseNameInput = style([ | ||
sprinkles({ typography: 'Regular15' }), | ||
{ | ||
border: `1px solid ${COLOR.Gray200}`, | ||
width: '100%', | ||
flex: 1, | ||
padding: '8px 12px', | ||
borderRadius: '6px', | ||
color: COLOR.Gray900, | ||
|
||
'::placeholder': { | ||
color: COLOR.Gray400, | ||
}, | ||
}, | ||
]); | ||
|
||
export const editButton = recipe({ | ||
base: [ | ||
sprinkles({ typography: 'Bold17' }), | ||
{ | ||
height: '56px', | ||
flex: 1, | ||
textAlign: 'center', | ||
borderRadius: '10px', | ||
backgroundColor: COLOR.Gray900, | ||
color: COLOR.MonoWhite, | ||
}, | ||
], | ||
variants: { | ||
isButtonDisabled: { | ||
true: { | ||
backgroundColor: COLOR.Gray300, | ||
cursor: 'default', | ||
}, | ||
false: { | ||
backgroundColor: COLOR.Gray900, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
export const modalCloseButton = style({ | ||
padding: '6px', | ||
color: COLOR.Gray400, | ||
}); |
69 changes: 69 additions & 0 deletions
69
src/features/path/path-name-edit-modal/PathNameEditModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { useState } from 'react'; | ||
|
||
import CloseIcon from '@/assets/icons/close.svg?react'; | ||
import Modal from '@/components/modal/Modal'; | ||
import { useModal } from '@/hooks/useModal'; | ||
import { useToast } from '@/hooks/useToast'; | ||
import type { MarkerType } from '@/types'; | ||
|
||
import * as S from './PathNameEditModal.css'; | ||
|
||
interface PropsType { | ||
pinId: string; | ||
pinName: string; | ||
modifyPinName: (props: Pick<MarkerType, 'pinId' | 'pinName'>) => void; | ||
} | ||
|
||
const PathNameEditModal = ({ pinId, pinName, modifyPinName }: PropsType) => { | ||
const { closeModal } = useModal(); | ||
const { setToast } = useToast(); | ||
|
||
const [isButtonDisabled, setIsButtonDisabled] = useState(false); | ||
const [newPathName, setNewPathName] = useState(pinName); | ||
|
||
const handleEditButtonClick = () => { | ||
modifyPinName({ pinId, pinName: newPathName }); | ||
closeModal(); | ||
setToast('코스 이름이 변경되었어요'); | ||
}; | ||
|
||
const handleNewPathNameChange = ({ | ||
target, | ||
}: React.ChangeEvent<HTMLInputElement>) => { | ||
if (!target.value) setIsButtonDisabled(true); | ||
else setIsButtonDisabled(false); | ||
|
||
setNewPathName(target.value); | ||
}; | ||
|
||
return ( | ||
<Modal> | ||
<div className={S.modalHeader}> | ||
<Modal.Title>코스명 수정</Modal.Title> | ||
<button className={S.modalCloseButton} onClick={closeModal}> | ||
<CloseIcon width={28} height={28} /> | ||
</button> | ||
</div> | ||
|
||
<Modal.Content> | ||
<input | ||
className={S.couseNameInput} | ||
value={newPathName} | ||
onChange={handleNewPathNameChange} | ||
/> | ||
</Modal.Content> | ||
|
||
<Modal.Footer> | ||
<button | ||
className={S.editButton({ isButtonDisabled })} | ||
onClick={handleEditButtonClick} | ||
disabled={isButtonDisabled} | ||
> | ||
수정 | ||
</button> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default PathNameEditModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import PathNameEditModal from './PathNameEditModal'; | ||
|
||
export default PathNameEditModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.