-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: create banner * patch: place banner around slideshow area * patch: improve banner styling * patch: adjust import path
- Loading branch information
1 parent
cae8d2d
commit 434d15f
Showing
2 changed files
with
84 additions
and
15 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
django_project/minisass_frontend/src/components/Banner/index.tsx
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,66 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { AiOutlineClose } from 'react-icons/ai'; | ||
|
||
const Banner: React.FC = () => { | ||
const [visible, setVisible] = useState(true); | ||
|
||
useEffect(() => { | ||
const timer = setTimeout(() => { | ||
setVisible(false); | ||
}, 15000); | ||
|
||
return () => clearTimeout(timer); | ||
}, []); | ||
|
||
const bannerStyle: React.CSSProperties = { | ||
backgroundColor: '#003f81', | ||
color: 'white', | ||
borderRadius: '8px', | ||
padding: '16px', | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
position: 'fixed', | ||
top: '0', | ||
left: '0', | ||
width: '100%', | ||
zIndex: 50, | ||
height: '10%', | ||
boxSizing: 'border-box' | ||
}; | ||
|
||
const textStyle: React.CSSProperties = { | ||
flex: 1, | ||
textAlign: 'center', | ||
marginTop: '2%' | ||
}; | ||
|
||
const buttonStyle: React.CSSProperties = { | ||
color: 'white', | ||
background: 'transparent', | ||
border: 'none', | ||
marginTop: '2%', | ||
display: 'flex', | ||
alignItems: 'center' | ||
}; | ||
|
||
return ( | ||
<> | ||
{visible && ( | ||
<div style={bannerStyle}> | ||
<span style={textStyle}> | ||
The miniSASS site will undergo routine maintenance on Friday, 30th August 2024. We apologize for any inconvenience caused by the brief downtime. | ||
</span> | ||
<button | ||
onClick={() => setVisible(false)} | ||
style={buttonStyle} | ||
> | ||
<AiOutlineClose size={24} /> | ||
</button> | ||
</div> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default Banner; |
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