Skip to content

Commit

Permalink
Add alert regarding esports center
Browse files Browse the repository at this point in the history
  • Loading branch information
novialriptide committed Sep 8, 2023
1 parent 4e96304 commit 8696b73
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 0 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@heroicons/react": "^2.0.18",
"@next/font": "13.1.6",
"@types/node": "18.13.0",
"@types/react": "18.0.28",
Expand Down
42 changes: 42 additions & 0 deletions src/components/banner-alert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { XMarkIcon } from '@heroicons/react/24/solid'
import React, { useState } from 'react'

interface IAlertBanner {
msg: string
}

export default function AlertBanner(props: IAlertBanner) {
const [isHidden, setHidden] = useState<boolean>(false)

function changeVisibility() {
setHidden(!isHidden)
}

return (
<div
style={{
backgroundColor: '#d62929',
paddingLeft: '20px',
paddingRight: '20px',
paddingBottom: '25px',
paddingTop: '25px',
color: 'white',
borderColor: 'white',
borderStyle: 'solid',
borderLeft: 0,
borderRight: 0,
borderTop: 0,
borderWidth: '1px',
display: `${isHidden ? 'none' : 'flex'}`,
justifyContent: 'center',
alignContent: 'center',
position: 'relative',
}}
>
<p style={{ margin: 0 }}>{props.msg}</p>
<div onClick={changeVisibility} style={{ position: 'absolute', right: 0, paddingRight: '20px' }}>
<XMarkIcon style={{ width: '25px', height: '25px' }} />
</div>
</div>
)
}
6 changes: 6 additions & 0 deletions src/data/misc-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Set the variable constant to `null` if you want to no longer show a message.
*/

export const alertMessage: string =
'The Esports Center on Busch Campus is closed until further notice. We apologize for the inconvenience.'
3 changes: 3 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import MeetOurClubs from '../components/meet-our-clubs'
import Footer from '../components/footer'
import Head from 'next/head'
import ContactUs from '@/components/contact-us'
import AlertBanner from '@/components/banner-alert'
import { alertMessage } from '@/data/misc-info'

export default function HomePage() {
return (
Expand All @@ -21,6 +23,7 @@ export default function HomePage() {
<link rel="icon" href="/favicon.ico" />
</Head>
<main className={styles['base']}>
{alertMessage != '' ? <AlertBanner msg={alertMessage} /> : <></>}
<NavigationBar />
<Hero />
<AboutOurselves />
Expand Down

0 comments on commit 8696b73

Please sign in to comment.