1
1
// src/components/ApplicationBanner.jsx
2
- import './styles.scss' ;
3
- // src/components/ApplicationBanner.jsx
4
- import { useEffect } from 'react' ;
2
+ import { useEffect , useState } from 'react' ;
5
3
import { useBanner } from '@/context/BannerContext' ;
4
+ import './styles.scss' ;
5
+ // import { Button } from '@/components/ui/moving-border'; - Implement moving border effect when hovered, also add fade-in for the border
6
6
7
7
const ApplicationBanner = ( ) => {
8
- const { setBannerVisible } = useBanner ( ) ;
8
+ const { isBannerVisible, setBannerVisibility, hideBanner } = useBanner ( ) ;
9
+ const [ isAnimating , setIsAnimating ] = useState ( false ) ;
9
10
10
11
useEffect ( ( ) => {
11
- setBannerVisible ( true ) ;
12
- return ( ) => setBannerVisible ( false ) ;
13
- } , [ setBannerVisible ] ) ;
12
+ setBannerVisibility ( true ) ;
13
+ return ( ) => setBannerVisibility ( false ) ;
14
+ } , [ setBannerVisibility ] ) ;
15
+
16
+ const handleClose = ( ) => {
17
+ setIsAnimating ( true ) ;
18
+ setTimeout ( ( ) => {
19
+ hideBanner ( ) ;
20
+ setIsAnimating ( false ) ;
21
+ } , 500 ) ; // Duration of the fade out animation
22
+ } ;
23
+
24
+ if ( ! isBannerVisible ) {
25
+ return null ;
26
+ }
14
27
15
28
return (
16
- < div className = "fixed top-0 left-0 w-full bg-blue-500 text-white text-center p-2 z-100" >
29
+ < div className = { `fixed top-0 left-0 w-full bg-gradient-to-r from-blue-500 to-purple-500 backdrop:blur-md text-white text-center p-2 z-100
30
+ ${
31
+ isAnimating ? 'fade-out-up' : ''
32
+ } `} >
17
33
< span className = "font-bold" > Last-minute call for our 2024 summer application!</ span >
18
34
< button onClick = { ( ) => window . location . href = '/application-form' }
19
35
aria-label = "Apply Now"
20
- className = "ml-6 inline-flex h-8 animate-shimmer items-center justify-center rounded-md border border-slate-800 bg-[linear-gradient(110deg,#000103,45%,#1e2631,55%,#000103)] bg-[length:200%_100%] px-6 font-medium text-slate-200 transition-colors focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 focus:ring-offset-slate-50 hover:bg-[linear-gradient(90deg, #6366f1, #a855f7)]" >
36
+ className = "ml-6 inline-flex h-8 animate-shimmer items-center justify-center rounded-md border border-slate-800 bg-[linear-gradient(110deg,#000103,45%,#343b45,55%,#000103)] bg-[length:200%_100%] px-6 font-medium text-slate-100
37
+ focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 focus:ring-offset-slate-50
38
+ backdrop-blur-sm hover:shadow-[0px_0px_4px_4px_rgba(0,0,0,0.15)] bg-white/[0.2] text-sm transition duration-200" >
21
39
Apply Now
22
- </ button >
40
+ </ button >
41
+ < div className = 'justify-self-end w-8 bg-transparent absolute right-4 mx-2 text-center align-middle transition ' >
42
+ < button className = "text-3xl font-white pt-[3px]" aria-label = 'Close' onClick = { handleClose } > ×</ button >
43
+ </ div >
23
44
</ div >
24
45
) ;
25
46
} ;
26
47
27
48
export default ApplicationBanner ;
28
-
29
-
30
- < button className = "p-[3px] relative" >
31
- < div className = "ml-6 inline-flex h-8 px-6 justify-center rounded-lg absolute inset-0 bg-gradient-to-r from-indigo-500 to-purple-500" >
32
- < div onClick = { ( ) => window . location . href = '/application-form' }
33
- className = "px-8 py-2 rounded-[6px] relative group transition duration-200 hover:bg-transparent animate-shimmer items-center border border-slate-800 bg-[linear-gradient(110deg,#000103,45%,#1e2631,55%,#000103)] bg-[length:200%_100%] font-medium text-slate-400 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 focus:ring-offset-slate-50" >
34
- Apply Now
35
- </ div >
36
- </ div >
37
- </ button >
0 commit comments