@@ -3,29 +3,42 @@ import React from 'react';
3
3
import Link from 'next/link' ;
4
4
import Image from 'next/image' ;
5
5
6
+ export function isEventEnded ( date ) {
7
+ const eventDate = date . split ( " " ) ;
8
+ const month = eventDate [ 0 ] ;
9
+ const year = eventDate [ eventDate . length - 1 ] ;
10
+ const startDay = eventDate [ 1 ] . split ( "-" ) [ 0 ] ;
11
+ return new Date ( `${ startDay } ${ month } ${ year } ` ) < Date . now ( )
12
+ }
13
+
14
+
6
15
function Venue ( { className, city } ) {
16
+
17
+ const eventEnded = isEventEnded ( city . date ) ;
18
+ const textColor = eventEnded ? "text-white" : "text-white" ;
19
+
7
20
return (
8
21
< Link href = { `/venue/${ city . name } ` } >
9
- < div style = { { '--image-url' : `url(${ city . img } )` } }
22
+ < div style = { { background : `linear-gradient(to bottom, rgba(0,0,0,.3), rgba(0,0,0, .3)), url(${ city . img } )` , backgroundSize : "cover" } }
10
23
className = 'relative w-[300px] h-[400px] sm:w-[250px] sm:h-[350px] card-bg rounded-md bg-[image:var(--image-url)] flex items-center justify-center p-4 cursor-pointer m-2' >
11
24
< div className = 'flex justify-between flex-col w-full h-full' >
12
25
< div className = 'flex items-center' >
13
- { city . cfp ? < div className = ' border text-white text-md rounded-lg p-1 text-center mt-2' > cfp is open</ div > :null }
26
+ { city . cfp ? < div className = { ` border ${ textColor } text-md rounded-lg p-1 text-center mt-2` } > cfp is open</ div > :null }
14
27
< button onClick = { ( e ) => {
15
28
e . preventDefault ( )
16
29
window . open ( city . map , '_blank' , 'noopener' )
17
30
} } className = 'w-8 h-8 bg-white rounded-xl flex items-center justify-center ml-auto' >
18
31
< Image src = '/img/mapIcon.svg' alt = 'Map Icon' width = { 24 } height = { 24 } />
19
32
</ button >
20
- < div > </ div >
21
33
</ div >
22
34
< div > </ div >
23
- < div className = 'text-white' >
35
+ < div className = { textColor } >
24
36
< div >
25
37
{ city . name == 'Online' ?< span className = 'text-lg font-bold' > { city . name } { city . country } </ span > :< span className = 'text-lg font-bold' > { city . country } , { city . name } </ span > }
26
38
</ div >
27
- < div className = 'flex items-center justify-between w-full' >
28
- < div className = 'border border-gray-400 rounded-lg p-1 text-center mt-2' > { city . date } </ div >
39
+ < div className = 'flex align-end flex-row justify-between pt-2' >
40
+ < div className = 'inline-block border border-gray-400 rounded-lg py-1 px-2 text-center' > { city . date } </ div >
41
+ < span className = ' text-white flex align-middle pt-2' style = { { fontSize : ".9em" } } > { eventEnded ? "ENDED" : "" } </ span >
29
42
</ div >
30
43
</ div >
31
44
</ div >
0 commit comments