-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 무한 스크롤 작동하도록 수정 * feat: 마이페이지에 투표 갯수를 불러오는 api 연동 * fix: 연령대대신 출생년도를 받도록 수정 * feat: 연령대를 나타내도록 수정 * feat: 회원탈퇴 후 로그아웃 처리 * refactor: 하나의 REGION_LIST를 사용하도록 수정 * refactor: RegionSelect 도메인별 분리 및 리팩터링 * fix: 버튼 안 버튼의 존재로 콘솔창에 뜨던 에러 제거 * feat: 서버의 에러 메시지를 보여주기 위해 axios의 interceptors에서 처리 * feat: 회원가입이 진행되지 않았을 경우 회원가입 페이지로 리다이렉트 처리 * fix: map처리 후 키 추가
- Loading branch information
Showing
21 changed files
with
342 additions
and
134 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
14 changes: 14 additions & 0 deletions
14
apps/jurumarble/src/app/my/services/useGetCountedVoteService.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,14 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { getTheNumberOfMyVoteAPI } from "lib/apis/my"; | ||
import { queryKeys } from "lib/queryKeys"; | ||
|
||
const getTheNumberOfMyVoteQueryKey = () => [queryKeys.THE_NUMBER_OF_MY_VOTE]; | ||
|
||
export default function useGetTheNumberOfMyVoteService() { | ||
const { data: theNumberOfMyVote } = useQuery( | ||
getTheNumberOfMyVoteQueryKey(), | ||
getTheNumberOfMyVoteAPI, | ||
); | ||
|
||
return theNumberOfMyVote; | ||
} |
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
130 changes: 130 additions & 0 deletions
130
apps/jurumarble/src/app/stamp/components/RegionSelect.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,130 @@ | ||
import { useToggle, useOutsideClick } from "@monorepo/hooks"; | ||
import { REGION_LIST } from "lib/constants"; | ||
import { useId } from "react"; | ||
import { SvgArrowDown } from "src/assets/icons/components"; | ||
import styled, { css } from "styled-components"; | ||
|
||
interface Props { | ||
regionOption: string; | ||
onChangeRegionOption: (id: string) => void; | ||
} | ||
|
||
const COPIED_REGION_LIST = [ | ||
{ value: "", label: "지역을 선택해주세요.", lat: 0, long: 0 }, | ||
...REGION_LIST, | ||
]; | ||
|
||
function RegionSelect({ regionOption, onChangeRegionOption }: Props) { | ||
const [isOpen, onToggleOpen] = useToggle(); | ||
const { targetEl } = useOutsideClick<HTMLDivElement>(isOpen, onToggleOpen); | ||
const uniqueId = useId(); | ||
|
||
return ( | ||
<SelectStyled isOpen={isOpen}> | ||
<div ref={targetEl}> | ||
<SelectButton | ||
type="button" | ||
id={`select-box-${uniqueId}`} | ||
aria-haspopup="true" | ||
aria-expanded="true" | ||
aria-controls={`select-list-${uniqueId}`} | ||
onClick={onToggleOpen} | ||
> | ||
<SelectedText className="selected-label"> | ||
{COPIED_REGION_LIST.find(({ value }) => value === regionOption)?.label} | ||
<span id="indicator"> | ||
<SvgArrowDown width={24} height={24} /> | ||
</span> | ||
</SelectedText> | ||
</SelectButton> | ||
{isOpen ? ( | ||
<Ul | ||
id={`select-list-${uniqueId}`} | ||
aria-labelledby={`select-box-${uniqueId}`} | ||
role="listbox" | ||
> | ||
{COPIED_REGION_LIST.map(({ value, label }) => ( | ||
<Li | ||
key={`select_${value}`} | ||
onClick={() => { | ||
onChangeRegionOption(value); | ||
onToggleOpen(); | ||
}} | ||
> | ||
{label} | ||
</Li> | ||
))} | ||
</Ul> | ||
) : null} | ||
</div> | ||
</SelectStyled> | ||
); | ||
} | ||
|
||
const SelectStyled = styled.div<{ isOpen: boolean }>` | ||
${({ theme, isOpen }) => css` | ||
${theme.typography.button01}; | ||
color: ${theme.colors.black_03}; | ||
border: 1px solid ${theme.colors.black_05}; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
height: 40px; | ||
border-radius: 8px; | ||
position: relative; | ||
#indicator { | ||
display: flex; | ||
align-items: center; | ||
color: ${theme.colors.black_01}; | ||
} | ||
svg { | ||
${isOpen && "transform: rotateX( 180deg )"} | ||
} | ||
`} | ||
`; | ||
|
||
const SelectButton = styled.button` | ||
display: contents; | ||
`; | ||
|
||
const SelectedText = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
`; | ||
|
||
const Ul = styled.ul` | ||
${({ theme }) => | ||
css` | ||
position: absolute; | ||
margin-top: 8px; | ||
border-radius: 8px; | ||
box-shadow: 0 0 40px 0 rgba(0, 0, 0, 0.1); | ||
z-index: 99; | ||
overflow: auto; | ||
left: 0px; | ||
top: 38px; | ||
width: 100%; | ||
height: 60vh; | ||
display: flex; | ||
flex-direction: column; | ||
border: solid 1px ${theme.colors.black_05}; | ||
background-color: ${theme.colors.white}; | ||
`} | ||
`; | ||
|
||
const Li = styled.li` | ||
${({ theme }) => css` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
padding: 16px 0; | ||
${theme.typography.button02}; | ||
:hover { | ||
background-color: ${theme.colors.bg_02}; | ||
} | ||
`}; | ||
`; | ||
|
||
export default RegionSelect; |
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
Oops, something went wrong.