-
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.
Merge pull request #103 from boostcampwm2023/feat/room/logic
Feat/room/logic : 룸 페이지 로직 추가
- Loading branch information
Showing
7 changed files
with
122 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
"Parens", | ||
"tailwindcss", | ||
"tanstack", | ||
"toastify", | ||
"typeorm", | ||
"Xmark" | ||
] | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 +1,30 @@ | ||
import CreateRoom from '../../public/mocks/CreateRoom.json'; | ||
import ExitButton from './buttons/ExitButton'; | ||
import { FaRegCopy } from 'react-icons/fa6'; | ||
import { ToastContainer, toast } from 'react-toastify'; | ||
import 'react-toastify/dist/ReactToastify.css'; | ||
|
||
export default function RoomInfo() { | ||
const copyToClipboard = () => { | ||
navigator.clipboard.writeText(CreateRoom.code); | ||
toast.success('Copied to clipboard!', { | ||
position: 'bottom-center', | ||
autoClose: 2000, | ||
hideProgressBar: true, | ||
}); | ||
}; | ||
return ( | ||
<div className="flex w-full items-center justify-between"> | ||
<div className="flex flex-row items-center rounded-lg text-aod_text"> | ||
<div className="pr-3 text-xl font-bold">{CreateRoom.code}</div> | ||
<button> | ||
<FaRegCopy /> | ||
</button> | ||
<> | ||
<div className="flex w-full items-center justify-between"> | ||
<div className="flex flex-row items-center rounded-lg text-aod_text"> | ||
<div className="pr-3 text-xl font-bold">{CreateRoom.code}</div> | ||
<button onClick={copyToClipboard}> | ||
<FaRegCopy /> | ||
</button> | ||
</div> | ||
<ExitButton /> | ||
</div> | ||
<ExitButton /> | ||
</div> | ||
<ToastContainer toastClassName={'bg-aod_fg text-aod_text'} /> | ||
</> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,40 @@ | ||
import { FaChartSimple } from 'react-icons/fa6'; | ||
import ScoreBoardModal from '../ScoreBoardModal/ScoreBoardModal'; | ||
import { useRef, useState } from 'react'; | ||
|
||
export default function ScoreboardButton() { | ||
const [isModalOpen, setIsModalOpen] = useState(false); | ||
const modalOverlayRef = useRef<HTMLDivElement>(null); | ||
|
||
const openModal = () => { | ||
setIsModalOpen(true); | ||
}; | ||
const closeModal = () => { | ||
setIsModalOpen(false); | ||
}; | ||
|
||
const modalOutsideClick = (event: React.MouseEvent<HTMLDivElement>) => { | ||
if (modalOverlayRef.current === event.target) { | ||
setIsModalOpen(false); | ||
} | ||
}; | ||
return ( | ||
<button className="flex w-full flex-row items-center justify-center rounded-lg bg-aod_accent px-3 py-2 text-aod_white hover:opacity-80"> | ||
<FaChartSimple /> | ||
<div className="pl-2 font-medium">Scoreboard</div> | ||
</button> | ||
<> | ||
<button | ||
className="flex w-full flex-row items-center justify-center rounded-lg bg-aod_accent px-3 py-2 text-aod_white hover:opacity-80" | ||
onClick={openModal}> | ||
<FaChartSimple /> | ||
<div className="pl-2 font-medium">Scoreboard</div> | ||
</button> | ||
{isModalOpen ? ( | ||
<ScoreBoardModal | ||
modalOverlayRef={modalOverlayRef} | ||
closeModal={closeModal} | ||
modalOutsideClick={modalOutsideClick} | ||
/> | ||
) : ( | ||
<></> | ||
)} | ||
</> | ||
); | ||
} |