-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEventItem.tsx
More file actions
78 lines (72 loc) · 2.68 KB
/
EventItem.tsx
File metadata and controls
78 lines (72 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import React from 'react';
import { motion } from 'framer-motion';
import DynamicLink from '../../components/DynamicLink/DynamicLink';
import HMButton from '../../components/Button/HMButton';
interface EventItemProps {
name: string;
date: string;
brief: string;
description: string;
bgImage: string;
frontImage: string;
link: string;
altBgImage: string;
altFrontImage: string;
}
const EventItem = ({ name, date, brief, description, bgImage, frontImage, link, altBgImage, altFrontImage }: EventItemProps) => {
let linkText: string;
if (!link) {
linkText = 'Upcoming!';
} else {
linkText = 'Sign up';
}
return (
<div className="rounded-[10px] mx-auto w-4/5 max-w-[800px] my-20 min-h-[200px]">
{/* small screen heading */}
<h2 className="text-4xl font-bold mb-2 md:hidden block text-center">{name}</h2>
<div
role="img"
aria-label={altBgImage}
className="md:ml-0 ml-6 h-[30vw] bg-cover bg-center rounded-[10px]"
style={{ backgroundImage: `url(${bgImage})` }}></div>
<div className="flex">
<div className="w-[60%] md:w-[40%] md:p-4">
<img
className="h-[120%] relative -top-[20%] rounded-[10px] object-cover w-full"
src={frontImage}
alt={altFrontImage}
/>
</div>
<motion.div
className="md:p-4 p-2 pr-0 flex flex-col justify-between w-[40%] md:w-[60%] "
viewport={{ amount: 'all', once: true }}
initial={{ opacity: 0, x: 20 }}
whileInView={{ opacity: 1, x: 0 }}>
<div>
<h2 className="text-4xl font-bold mb-2 hidden md:block">{name}</h2>
<div className="flex flex-col md:flex-row gap-2 mb-2 md:text-xs sm:text-xl text-base">
<p className="font-bold">{date}</p>
<p className="text-neutral-400">{brief}</p>
</div>
<p className="text-sm overflow-y-hidden min-h-[40%] mb-2 hidden md:block">{description}</p>
</div>
<div className="hidden md:block">
<HMButton text={linkText} color="primary" link={link}></HMButton>
</div>
</motion.div>
</div>
{/* small screen items */}
<motion.div
className="p-4 flex flex-col items-center justify-between w-[100%]"
viewport={{ amount: 'all', once: true }}
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}>
<p className="md:hidden block text-sm overflow-y-hidden min-h-[40%] mb-2">{description}</p>
<div className=" md:hidden">
<HMButton text={linkText} color="primary" link={link}></HMButton>
</div>
</motion.div>
</div>
);
};
export default EventItem;