-
Notifications
You must be signed in to change notification settings - Fork 0
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] 인터랙션 모달 분기 처리 #83
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9778134
[refactor] swiper slideTo 기능을 함수로 자식에 넘겨줌
darkdulgi dd7730a
[feat] 인터랙션 모달 분기 처리 약간
darkdulgi 27ed8f1
[feat] 사용자 로그인 상태에 대한 일부 분기처리 적용
darkdulgi cc55226
[design] 인터랙션 모달 반응형 약간
darkdulgi 8c00532
[feat] 타이머 클릭시 선착순 이벤트 섹션으로 이동
darkdulgi a6dda6b
[design] 인터랙션 섹션 반응형 디자인
darkdulgi 3bc5ae7
Merge branch 'dev' into feature/10-interactionpage
darkdulgi 5ef518c
[chore] 미사용 import 제거
darkdulgi 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,39 @@ | ||
import userStore from "@/auth/store.js"; | ||
import scrollTo from "@/scroll/scrollTo"; | ||
import style from "./InteractionAnswer.module.css"; | ||
import { useState } from "react"; | ||
import { useEffect, useState } from "react"; | ||
import openModal from "@/modal/openModal.js"; | ||
import AuthModal from "@/auth/AuthModal.jsx"; | ||
// import fcfsStore from "@/fcfs/store"; | ||
|
||
export default function InteractionAnswer({ | ||
isAnswerUp, | ||
setIsAnswerUp, | ||
answer, | ||
close, | ||
isLogin, | ||
}) { | ||
const isLogin = userStore((state) => state.isLogin); | ||
// const currentServerTime = fcfsStore((state) => state.currentServerTime); | ||
const [isAniPlaying, setIsAniPlaying] = useState(false); | ||
const [isEventToday, setIsEventToday] = useState(false); | ||
const [isJoined, setIsJoined] = useState(false); | ||
const authModal = ( | ||
<AuthModal | ||
onComplete={() => { | ||
/* | ||
* 비로그인자가 정보등록을 성공시켰을 때 서버로 추첨이벤트 참여 api를 보내는 코드 미구현 | ||
*/ | ||
}} | ||
/> | ||
); | ||
|
||
useEffect(() => { | ||
/* | ||
* 서버에서 해당 날짜의 사용자 응모 여부와, 시간을 받아온 후 이벤트 날짜와 비교하는 코드 미구현 | ||
*/ | ||
|
||
setIsEventToday(true); | ||
setIsJoined(false); | ||
}, []); | ||
|
||
function onClickWrite() { | ||
close(); | ||
|
@@ -21,8 +44,11 @@ export default function InteractionAnswer({ | |
setIsAniPlaying(true); | ||
|
||
/* | ||
* 서버에서 받아온 단축 url을 클립보드에 복사하는 코드 미구현 | ||
* 서버에서 단축 url을 받아오는 코드 미구현 | ||
*/ | ||
|
||
const simpleURL = "https://youtu.be/KMU0tzLwhbE"; | ||
navigator.clipboard.writeText(simpleURL); | ||
} | ||
|
||
return ( | ||
|
@@ -38,33 +64,38 @@ export default function InteractionAnswer({ | |
|
||
<button | ||
onClick={() => setIsAnswerUp(false)} | ||
className="absolute top-10 left-10 p-3 bg-neutral-800 rounded-full" | ||
className="absolute top-5 xl:top-10 left-5 xl:left-10 p-1 xl:p-3 bg-neutral-800 rounded-full" | ||
> | ||
<img src="icons/left-arrow.svg" alt="뒤로가기" /> | ||
</button> | ||
|
||
<div className="w-1/2 flex gap-8"> | ||
<span className="text-head-l text-blue-400 font-bold whitespace-pre"> | ||
<div className="w-2/3 xl:w-1/2 flex flex-col xl:flex-row gap-2 xl:gap-8"> | ||
<span className="text-head-s xl:text-head-l text-blue-400 font-bold whitespace-pre"> | ||
Comment on lines
+72
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 반응형 편-안 |
||
{answer.head} | ||
</span> | ||
|
||
<div className="flex flex-col gap-4"> | ||
<span className="text-title-s text-neutral-50">{answer.desc}</span> | ||
<span className="text-body-l xl:text-title-s text-neutral-50">{answer.desc}</span> | ||
|
||
<span className="text-body-s text-neutral-300">{answer.subdesc}</span> | ||
<span className="text-detail-l xl:text-body-s text-neutral-300">{answer.subdesc}</span> | ||
</div> | ||
</div> | ||
|
||
<div className="absolute bottom-10 flex flex-col items-center gap-10"> | ||
{isLogin ? ( | ||
<> | ||
<span className="text-body-m text-green-400 font-bold"> | ||
오늘 응모가 완료되었습니다! | ||
{isJoined | ||
? "오늘 응모가 완료되었습니다!" | ||
: "응모 기간이 지났습니다!"} | ||
</span> | ||
|
||
<div className="flex gap-4 items-end"> | ||
<div className="flex flex-col gap-2"> | ||
<div className="relative flex flex-col items-center animate-bounce"> | ||
<span className=" bg-green-400 text-nowrap text-body-m text-neutral-800 rounded-full px-8 py-2 font-bold"> | ||
<div | ||
className={`${isEventToday ? "" : "hidden"} relative flex flex-col items-center animate-bounce`} | ||
> | ||
<span className=" bg-green-400 text-nowrap text-body-s xl:text-body-m text-neutral-800 rounded-full px-4 xl:px-8 py-1 xl:py-2 font-bold"> | ||
당첨확률 UP! | ||
</span> | ||
|
||
|
@@ -73,22 +104,25 @@ export default function InteractionAnswer({ | |
|
||
<button | ||
onClick={onClickWrite} | ||
className="bg-white text-body-m text-black px-10 py-4" | ||
className="bg-white text-body-m text-black px-5 xl:px-10 py-2 xl:py-4" | ||
> | ||
기대평 작성하기 | ||
</button> | ||
</div> | ||
|
||
<button | ||
onClick={onClickShare} | ||
className="border-2 border-neutral-300 text-body-m text-white px-10 py-[14px]" | ||
className="border-2 border-neutral-300 text-body-m text-white px-5 xl:px-10 py-[7px] xl:py-[14px]" | ||
> | ||
공유하기 | ||
</button> | ||
</div> | ||
</> | ||
) : ( | ||
<button className="text-body-m text-black bg-white px-10 py-4"> | ||
<button | ||
onClick={() => openModal(authModal)} | ||
className="text-body-m text-black bg-white px-10 py-4" | ||
> | ||
응모하기 | ||
</button> | ||
)} | ||
|
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
Oops, something went wrong.
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.
토스트 관련된 상태와 엘리먼트들은 전부 별개의 컴포넌트로 분리하는 게 좋습니다.