Skip to content

Commit

Permalink
Update help modal style and added tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
samanthathompson52 committed Apr 3, 2024
1 parent cf6f969 commit c0d7416
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 13 deletions.
12 changes: 12 additions & 0 deletions client/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ p {
line-height: normal;
}

span {
font-family: Mochiy Pop One;
}

/* Reset some default styles */
html, body {
margin: 0;
Expand Down Expand Up @@ -125,6 +129,14 @@ html, body {
background-color: var(--orange);
}

.tooltip {
@apply invisible absolute;
}

.has-tooltip:hover .tooltip {
@apply visible z-50;
}

@media only screen and (max-width: 640px) {
h1 {
font-size: 2.2rem;
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Answer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const Answer = ({sendJsonMessage, prompt, players, playerId, isHost}: {sendJsonM
<h3 className='pb-20 flex'>
<span className='grow'>{prompt}</span>
{isHost &&
<div className='pl-2 flex items-start'>
<div className='has-tooltip pl-2 flex items-start'>
<span className='tooltip rounded shadow-lg p-1 m-2 bg-lightPurple text-center text-xs -mt-12 mr-4'>Skip this prompt</span>
<button onClick={() => shuffle()}>
<ForwardIcon className="h-9 w-9" aria-hidden="true" />
</button>
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const Header = ({roomCode}: {roomCode:string}) => {
</a>
</div>
{roomCode !== "" &&
<div className="flex justify-end cursor-pointer" onClick={() => copyRoomCode()}>
<div className="has-tooltip flex justify-end cursor-pointer" onClick={() => copyRoomCode()}>
<span className='tooltip rounded shadow-lg p-1 m-1 bg-lightPurple text-center text-xs'>Click here to copy <br /> the game link!</span>
<p className='self-end pb-1 pr-2 md:pb-4 md:pr-3 text-center'>Room Code:<br/> {roomCode}</p>
</div>}
</div>
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/Help.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export default function Help({open, setOpen, title, text}: {open: boolean, setOp
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="relative transform rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
<div className="bg-white px-4 pb-4 pt-5 sm:p-6 sm:pb-4">
<Dialog.Panel className="relative transform rounded-lg bg-white text-left shadow-xl transition-all border-4 border-purple sm:my-8 sm:w-full sm:max-w-lg">
<div className="px-4 pb-4 pt-5 sm:p-6 sm:pb-4">
<div className="sm:flex sm:items-start">
<div className="mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left">
<Dialog.Title as="h3" className="text-base font-semibold leading-6 text-gray-900">
{title}
<Dialog.Title className="text-base font-semibold leading-6 text-gray-900">
<h4>{title}</h4>
</Dialog.Title>
<XMarkIcon type="button" onClick={() => setOpen(false)} className="cursor-pointer h-7 w-7 absolute right-2 top-2" aria-hidden="true" />
<div className="mt-2">
Expand Down
34 changes: 29 additions & 5 deletions client/src/components/Join.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const Join = ({sendJsonMessage, roomCode, setRoomCode}: {sendJsonMessage: any, r
const roomParam = queryParameters.get("room")
if (roomParam === undefined || roomParam === null) return;
roomCodeInput(roomParam);
setType("join_room");
});

const createRoom = () => {
Expand All @@ -30,6 +31,11 @@ const Join = ({sendJsonMessage, roomCode, setRoomCode}: {sendJsonMessage: any, r
});
};

const goBack = () => {
setType("");
setRoomCode("");
};

const usernameInput = (inStr: string) => {
if (!verifyInput(inStr, 10)) return;
setUsername(inStr);
Expand All @@ -52,15 +58,33 @@ const Join = ({sendJsonMessage, roomCode, setRoomCode}: {sendJsonMessage: any, r
<div>
<div className="pb-10">
<h4 className='text-left pb-2'>Enter your name:</h4>
<input name="username" type="text" aria-label="Username"
value={username} onChange={(e) => usernameInput(e.target.value)}
<input
name="username"
type="text"
aria-label="Username"
value={username}
onChange={(e) => usernameInput(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter") {
enterRoom();
}
}}
className="orange-input" />
</div>
{type === "join_room" &&
<div className="pb-10">
<h4 className='text-left pb-2'>Enter room code:</h4>
<input name="roomCode" type="text" aria-label="Room code"
value={roomCode} onChange={(e) => roomCodeInput(e.target.value)}
<input
name="roomCode"
type="text"
aria-label="Room code"
value={roomCode}
onChange={(e) => roomCodeInput(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter") {
enterRoom();
}
}}
className="orange-input" />
</div>
}
Expand All @@ -73,7 +97,7 @@ const Join = ({sendJsonMessage, roomCode, setRoomCode}: {sendJsonMessage: any, r
</div>
</div>
</div>
<button onClick={() => setType("")}>
<button onClick={goBack}>
<div className="flex items-center">
<ArrowLeftIcon className="h-9 w-9" aria-hidden="true" />
<p>Go Back</p>
Expand Down
4 changes: 2 additions & 2 deletions client/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module.exports = {
},
},
colors: {
main: '#93C5FD',
mainlight: '#E3F0FF',
main: '#C5ADEB',
mainlight: '#e2d6f5',
purple: '#C5ADEB',
lightPurple: '#e2d6f5',
green: '#9AEDB6',
Expand Down

0 comments on commit c0d7416

Please sign in to comment.