-
Notifications
You must be signed in to change notification settings - Fork 3
feat: #45/이달의 차트 투표 모달창 레이아웃 구현 #140
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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,26 @@ | ||
| import MonthlyChartItem from '@/pages/listPage/monthlyChart/MonthlyChartItem'; | ||
|
|
||
| const MonthlyChartVoteList = ({ idols, selectedIdol, setSelectedIdol }) => { | ||
| return ( | ||
| <div className="flex flex-col mt-[24px] mb-[40px]"> | ||
| {idols.map((idol, idx) => ( | ||
| <div key={idol.id} onClick={() => setSelectedIdol(idol.id)}> | ||
| <MonthlyChartItem idol={idol} rank={idx + 1} layout="vote"> | ||
| <div className="relative flex items-center justify-center"> | ||
| <div | ||
| className={`w-[16px] h-[16px] rounded-full border-[2px] bg-gray-100 border-gray-300 ${selectedIdol === idol.id ? 'border-coralRed' : ''} flex items-center justify-center`} | ||
| > | ||
| <div | ||
| className={`absolute w-2 h-2 rounded-full bg-coralRed transition-transform ${selectedIdol === idol.id ? 'scale-100' : 'scale-0'}`} | ||
| /> | ||
| </div> | ||
| </div> | ||
| </MonthlyChartItem> | ||
| <div className="w-full h-[1px] bg-white bg-opacity-10 my-[4px]"></div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default MonthlyChartVoteList; |
This file contains hidden or 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,67 @@ | ||
| import { useState, useEffect } from 'react'; | ||
| import MonthlyChartVoteList from '@/components/modalContent/MonthlyChartVoteList'; | ||
| import { getLists } from '@/apis/monthlyChartApi'; | ||
| import PrimaryButton from '@/components/PrimaryButton'; | ||
|
|
||
| const MonthlyChartVoteModal = ({ gender }) => { | ||
| const [cursor, setCursor] = useState(0); | ||
| const [idolData, setIdolData] = useState([]); | ||
| const [loading, setLoading] = useState(false); | ||
| const [selectedIdol, setSelectedIdol] = useState(0); | ||
|
|
||
| const loadIdolData = async () => { | ||
| setLoading(true); | ||
| try { | ||
| const response = await getLists(gender, cursor, 10); | ||
| if (cursor !== 0) { | ||
| setIdolData((prev) => [...prev, ...response.idols]); | ||
| } else { | ||
| setIdolData(response.idols); | ||
| } | ||
| setCursor(response.nextCursor); | ||
| } catch (error) { | ||
| console.error(error); | ||
| } finally { | ||
| setLoading(false); | ||
| } | ||
| }; | ||
|
|
||
| const loadMoreData = () => { | ||
| if (cursor === null) { | ||
| alert('불러올 데이터가 없습니다.'); | ||
| } else { | ||
| loadIdolData(); | ||
| } | ||
| }; | ||
|
|
||
| useEffect(() => { | ||
| setIdolData([]); | ||
| setCursor(0); | ||
| loadIdolData(); | ||
| }, [gender]); | ||
|
|
||
| return ( | ||
| <div className="w-[calc(100%-48px)] h-[693px] tablet:w-[525px] tablet:h-[693px] pc:w-[525px] pc:h-[693px] overflow-y-auto"> | ||
| {loading ? ( | ||
| <div className="text-center text-white">로딩 중입니다...</div> | ||
| ) : ( | ||
| <MonthlyChartVoteList | ||
| idols={idolData} | ||
| selectedIdol={selectedIdol} | ||
| setSelectedIdol={setSelectedIdol} | ||
| /> | ||
| )} | ||
| <div className="fixed bottom-0 w-[calc(100%-48px)] h-[106px] text-white leading-[26px] bg-midnightBlack/80 tablet:w-[525px] pc:w-[525px] tablet:bg-transparent pc:bg-transparent"> | ||
| <PrimaryButton className="w-full h-[42px] font-bold text-[14px] font-pretendard"> | ||
| 투표하기 | ||
| </PrimaryButton> | ||
| <p className="font-medium text-[12px] text-center"> | ||
| 투표하는 데<span className=" text-coralRed"> 1000 크레딧</span>이 | ||
| 소모됩니다. | ||
| </p> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default MonthlyChartVoteModal; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저희 tailwind.config.js 파일 확인해보시면
모바일 화면 breakpoint가 375라 375px 이상이 모바일 화면인 것으로 알고 있습니다. 그래서 innerWidth가 768px 미만일 때 모바일 버전 투표 모달창을 보여주도록 조건을 바꿔줘야 할 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그리고 지금은 화면이 375px 이하일 때 '차트 투표하기를 눌렀을 경우에만 제대로 모바일 버전 모달창이 나오는 것 같습니다.
375px 이하의 화면에서 차트 투표하기를 눌렀을 때

위 상태에서 화면 사이즈가 375px을 초과했을 때

이렇게 화면 크기가 375px을 초과했는데도 여전히 모바일 버전 모달창으로 보입니다!
375px을 초과한 사이즈의 화면에서 차트 투표하기를 눌렀을 때

위 상태에서 화면 사이즈가 375px 이하가 되었을 때

이렇게 화면 크기가 375px 이하가 되니 모바일 버전 모달창이 되는 것이 아닌, pc와 tablet에서 쓰이는 모달창이 계속 쓰여서 모달창이 많이 깨져있는 것을 확인했습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그래서 여기서도 반응형을 사용하는 건 어떨까 싶습니다