Skip to content

Commit 3cc04e5

Browse files
authored
Merge pull request #22 from hack4impact-calpoly/program-component-card
Program component card
2 parents a2905c6 + 9e9093e commit 3cc04e5

File tree

4 files changed

+131
-0
lines changed

4 files changed

+131
-0
lines changed

public/waves.png

92.4 KB
Loading

src/app/page.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
import Navbar from "@/components/Navbar";
22
import EventCard from "@/components/EventCard";
3+
import Program from "@/components/Program";
34

45
export default function Home() {
56
return (
67
<main>
78
<Navbar />
89
<h1>Home</h1>
910

11+
{/* placehodler for testing
12+
<Program
13+
image="/waves.png"
14+
title="Operation Surf"
15+
location="Santa Cruz, CA"
16+
date="July 15, 2024"
17+
time="10:00 AM - 2:00 PM"
18+
/>
19+
*/}
20+
1021
{/* placeholder for testing
1122
<EventCard
1223
place="Place"

src/components/Program.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import style from "@/styles/Program.module.css";
2+
3+
export type ProgramProps = {
4+
image: string;
5+
title: string;
6+
location: string;
7+
date: string;
8+
time: string;
9+
onClick?: () => void;
10+
};
11+
12+
const Program = ({ image, title, location, date, time, onClick }: ProgramProps) => {
13+
return (
14+
<div className={style.cardContainer}>
15+
<img className={style.cardImage} src={image} alt="Header Image" />
16+
<div className={style.cardMeta}>
17+
<h2 className={style.cardTitle}>{title}</h2>
18+
<p className={style.cardLocation}>{location}</p>
19+
<p className={style.cardDate}>{date}</p>
20+
<p className={style.cardTime}>{time}</p>
21+
</div>
22+
<button className={style.cardButton} onClick={onClick}>
23+
View Details
24+
</button>
25+
</div>
26+
);
27+
};
28+
29+
export default Program;

src/styles/Program.module.css

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
.cardContainer {
2+
width: 100%; /* Make the card take up the full width of its parent container */
3+
font-family: "Inter", sans-serif;
4+
display: flex;
5+
font-weight: 300;
6+
flex-direction: column;
7+
max-width: 450px;
8+
background: #ffffff;
9+
border-radius: 20px;
10+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
11+
overflow: hidden;
12+
}
13+
14+
/* Top Image */
15+
.cardImage {
16+
height: auto;
17+
object-fit: cover;
18+
}
19+
20+
/* Meta Section */
21+
.cardMeta {
22+
display: flex;
23+
flex-direction: column;
24+
margin-left: 36px;
25+
gap: 10px;
26+
}
27+
28+
.cardMeta p {
29+
margin: 0;
30+
}
31+
32+
/* Title */
33+
.cardTitle {
34+
font-size: 24px;
35+
font-weight: 400;
36+
color: #737144;
37+
margin-bottom: 10px;
38+
margin-top: 40px;
39+
}
40+
41+
/* Button */
42+
.cardButton {
43+
width: 90%;
44+
padding: 16px;
45+
font-size: 18px;
46+
border-radius: 14px;
47+
border: none;
48+
background-color: #737144;
49+
color: white;
50+
margin: 0 auto 20px auto;
51+
display: block;
52+
margin-top: 20px;
53+
}
54+
55+
/* On Hover */
56+
.cardButton:hover {
57+
background-color: #737144;
58+
}
59+
60+
.cardLocation::before {
61+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737144' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s7-5.5 7-12a7 7 0 1 0-14 0c0 6.5 7 12 7 12z'/%3E%3Ccircle cx='12' cy='10' r='2.5'/%3E%3C/svg%3E");
62+
}
63+
64+
.cardDate::before {
65+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737144' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='16' rx='2.5'/%3E%3Cpath d='M8 2.5v4'/%3E%3Cpath d='M16 2.5v4'/%3E%3Cpath d='M3 9.5h18'/%3E%3C/svg%3E");
66+
}
67+
68+
.cardTime::before {
69+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737144' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3.5 2'/%3E%3C/svg%3E");
70+
}
71+
72+
.cardLocation,
73+
.cardDate,
74+
.cardTime {
75+
display: flex;
76+
align-items: center;
77+
gap: 14px;
78+
}
79+
80+
.cardLocation::before,
81+
.cardDate::before,
82+
.cardTime::before {
83+
content: "";
84+
display: inline-block;
85+
width: 34px;
86+
height: 34px;
87+
flex-shrink: 0;
88+
background-repeat: no-repeat;
89+
background-position: center;
90+
background-size: contain;
91+
}

0 commit comments

Comments
 (0)