-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from deveshsawant05/redesign-events-page
Redesigned Events Page
- Loading branch information
Showing
5 changed files
with
174 additions
and
103 deletions.
There are no files selected for viewing
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,70 @@ | ||
import React, { useState } from "react"; | ||
|
||
import { getPublicUrl } from "@/lib/utils"; | ||
import Link from "next/link"; | ||
|
||
import { Montserrat, Alata } from "next/font/google"; | ||
const montserratFont = Montserrat({ | ||
weight: ["100", "200", "400", "600"], | ||
subsets: ["latin"], | ||
}); | ||
const boldMontserratFont = Montserrat({ | ||
weight: ["600"], | ||
subsets: ["latin"], | ||
}); | ||
|
||
export default function EventCard(props) { | ||
const [event, setEvent] = useState(props.event); | ||
const [eventDate, setEventDate] = useState(event.date); | ||
const [eventTime, setEventTime] = useState(event.time); | ||
let posterUrl = getPublicUrl(`/events/${event.id}/poster`); | ||
return ( | ||
<div className={`${montserratFont.className} lg:row-span-2 lg:col-span-1 w-full h-full`}> | ||
<Link href={`\\event\\${event.id}`}> | ||
<div className="flex flex-col"> | ||
<div className="w-full h-full border-2 border-primary rounded-2xl overflow-hidden"> | ||
<img src={posterUrl} className="object-cover" /> | ||
</div> | ||
<div className={`${montserratFont.className} ms-2 mt-1`}> | ||
<p className="text-primary">{formatDate(eventDate)} | {formatTime(eventTime)}</p> | ||
<p className="font-semibold text-xl">{event.name}</p> | ||
<p className="text-sm">{trimString(event.description,50)}</p> | ||
</div> | ||
</div> | ||
</Link> | ||
</div> | ||
); | ||
} | ||
function formatDate(dateString) { | ||
const [year, month, day] = dateString.split("-"); | ||
const date = new Date(year, month - 1, day); // Month is 0-indexed | ||
|
||
const formattedDay = date.getDate(); | ||
const monthName = date.toLocaleString("default", { month: "long" }); | ||
const formattedYear = date.getFullYear(); | ||
|
||
return `${formattedDay} ${monthName} ${formattedYear}`; | ||
} | ||
|
||
|
||
const formatTime = (timeString) => { | ||
const timeRegex = /^(\d{2}):(\d{2}):(\d{2})$/; | ||
const match = timeString.match(timeRegex); | ||
if (!match) { | ||
return 'Invalid Time Format'; | ||
} | ||
let hours = parseInt(match[1], 10); | ||
const minutes = parseInt(match[2], 10); | ||
const ampm = hours >= 12 ? 'PM' : 'AM'; | ||
hours = hours % 12; | ||
hours = hours ? hours : 12; | ||
const formattedMinutes = String(minutes).padStart(2, '0'); | ||
return `${hours}:${formattedMinutes} ${ampm}`; | ||
}; | ||
|
||
const trimString = (str, maxLength) => { | ||
if (str.length > maxLength) { | ||
return str.substring(0, maxLength) + '...'; | ||
} | ||
return str; | ||
}; |
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,17 @@ | ||
import React from "react"; | ||
import Navbar from "@/components/navbar"; | ||
import Footer from "@/components/footer"; | ||
|
||
interface RootLayoutProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
export default function RootLayout({ children }: RootLayoutProps) { | ||
return ( | ||
<> | ||
<Navbar /> | ||
{children} | ||
<Footer /> | ||
</> | ||
); | ||
} |
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
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,30 @@ | ||
.show-more-button{ | ||
|
||
box-sizing: border-box; | ||
width: 300px; | ||
height: 45px; | ||
|
||
background-color : color-mix(in srgb, var(--primary) 5%, transparent); | ||
box-shadow: color-mix(in srgb, #fff 5%, transparent) 1px 1px 15px; | ||
border: solid color-mix(in srgb, var(--primary) 20%, transparent) 1px; | ||
border-radius: 43px; | ||
|
||
transition: 0.5s; | ||
} | ||
.show-more-button:hover{ | ||
background-color : color-mix(in srgb, var(--muted-foreground) 40%, transparent); | ||
} | ||
.show-more-button>p{ | ||
font-weight: 700; | ||
font-size: 18px; | ||
|
||
color: var(--primary); | ||
} | ||
|
||
@media screen and (max-width : 1024px){ | ||
.show-more-button{ | ||
|
||
box-sizing: border-box; | ||
width: 200px; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
dffefec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for iiitvcc ready!
✅ Preview
https://iiitvcc-fg9lgqr07-iiitv-coding-clubs-projects.vercel.app
Built with commit dffefec.
This pull request is being automatically deployed with vercel-action