-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add modal that gets displayed on successful checkin (#152)
* Add modal that gets displayed on successful checkin * address comments * Fix merge stuff
- Loading branch information
1 parent
6621e75
commit 18be91c
Showing
9 changed files
with
529 additions
and
10 deletions.
There are no files selected for viewing
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 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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Modal, Typography } from '@/components/common'; | ||
import { PublicEvent } from '@/lib/types/apiResponses'; | ||
import Image from 'next/image'; | ||
import { useMemo } from 'react'; | ||
import style from './style.module.scss'; | ||
|
||
interface CheckInModalProps { | ||
open: boolean; | ||
event?: PublicEvent; | ||
onClose: () => void; | ||
} | ||
|
||
const CHECKIN_TITLES = [ | ||
'Yippee!', | ||
'Brilliant!', | ||
'Wahoo!', | ||
'Awesome!', | ||
'Nice to see you!', | ||
'Congrats!', | ||
'Hello World!', | ||
'Welcome!', | ||
]; | ||
|
||
const CheckInModal = ({ open, event, onClose }: CheckInModalProps) => { | ||
const headerText = useMemo( | ||
() => CHECKIN_TITLES[Math.floor(Math.random() * CHECKIN_TITLES.length)], | ||
[] | ||
); | ||
|
||
if (!event) { | ||
return null; | ||
} | ||
|
||
const { pointValue, title } = event; | ||
|
||
return ( | ||
<Modal open={open} onClose={onClose}> | ||
<div className={style.container}> | ||
<div className={style.graphic}> | ||
<Image | ||
src="/assets/graphics/portal/treasure.svg" | ||
alt="A diamond with a smiley face looks at an open treasure chest." | ||
fill | ||
/> | ||
</div> | ||
<div className={style.header}> | ||
<Typography | ||
variant="display/light/small" | ||
className={style.headerText} | ||
suppressHydrationWarning | ||
> | ||
{headerText} | ||
</Typography> | ||
<div className={style.subheader}> | ||
<Typography variant="h4/regular" component="span" className={style.subheaderText}> | ||
{'You just earned '} | ||
<strong>{pointValue}</strong> | ||
{' membership points for checking into '} | ||
<strong>{title}</strong>! | ||
</Typography> | ||
<Typography variant="h4/regular" className={style.subheaderText} /> | ||
</div> | ||
</div> | ||
<button type="submit" className={style.done}> | ||
<Typography variant="h4/bold">Done</Typography> | ||
</button> | ||
</div> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default CheckInModal; |
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,85 @@ | ||
@use 'src/styles/vars.scss' as vars; | ||
|
||
.container { | ||
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
max-width: 50rem; | ||
padding: 2rem; | ||
|
||
.graphic { | ||
aspect-ratio: 560 / 283; | ||
border-radius: 1rem; | ||
overflow: hidden; | ||
position: relative; | ||
width: 100%; | ||
} | ||
|
||
.header { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.25rem; | ||
|
||
.headerText { | ||
text-align: center; | ||
|
||
@media screen and (width <= vars.$breakpoint-md) { | ||
font-size: 2rem !important; | ||
line-height: 2.5rem !important; | ||
} | ||
} | ||
|
||
.subheader { | ||
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
.subheaderText { | ||
text-align: center; | ||
|
||
@media screen and (width <= vars.$breakpoint-md) { | ||
font-size: 1rem !important; | ||
line-height: 1.5rem !important; | ||
} | ||
} | ||
} | ||
|
||
.close { | ||
align-items: center; | ||
background: none; | ||
display: flex; | ||
height: 3.75rem; | ||
margin-left: 1rem; | ||
padding: 0; | ||
} | ||
} | ||
|
||
.image { | ||
aspect-ratio: 1920 / 1080; | ||
border-radius: 10px; | ||
flex-shrink: 0; | ||
overflow: hidden; | ||
position: relative; | ||
width: 100%; | ||
} | ||
|
||
.done { | ||
border-radius: 2rem; | ||
padding: 1rem; | ||
width: 50%; | ||
|
||
@media screen and (width <= vars.$breakpoint-md) { | ||
padding: 0.5rem; | ||
|
||
div { | ||
font-size: 1rem !important; | ||
line-height: 1.5rem !important; | ||
} | ||
} | ||
} | ||
|
||
@media screen and (width <= vars.$breakpoint-md) { | ||
max-width: calc(100vw - 2rem); | ||
} | ||
} |
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,17 @@ | ||
export type Styles = { | ||
close: string; | ||
container: string; | ||
done: string; | ||
graphic: string; | ||
header: string; | ||
headerText: string; | ||
image: string; | ||
subheader: string; | ||
subheaderText: string; | ||
}; | ||
|
||
export type ClassNames = keyof Styles; | ||
|
||
declare const styles: Styles; | ||
|
||
export default styles; |
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,6 +1,7 @@ | ||
@use 'src/styles/vars.scss' as vars; | ||
|
||
.label { | ||
align-items: center; | ||
display: flex; | ||
gap: 0.5em; | ||
|
||
|
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