-
Notifications
You must be signed in to change notification settings - Fork 4
feat: added sponsors section in homepage #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: rohansen856 <rohansen856@gmail.com>
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Pull Request Overview
This PR adds a new sponsors section to the homepage that showcases sponsors and food partners with animated floating logos and a thank-you message.
Key changes:
- Added a new
Sponsors
component with floating animations for sponsor logos - Integrated the sponsors section into the homepage between prizes and contact sections
Reviewed Changes
Copilot reviewed 2 out of 6 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
src/components/Sponsors.tsx | New component with sponsor/partner data, floating animations, and responsive design |
src/app/page.tsx | Added import and section for the new Sponsors component |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
className="mx-4 h-[200px] md:h-[300px] lg:h-[400px] w-full relative" | ||
> | ||
<div | ||
key={sponsor.name} |
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.
Duplicate key prop detected. The key prop is already defined on line 56 for the parent div element. Remove the duplicate key from line 60.
key={sponsor.name} |
Copilot uses AI. Check for mistakes.
left: index === 0 ? "50%" : index === 1 ? "50%" : "80%", | ||
top: index === 0 ? "50%" : index === 1 ? "75%" : "40%", |
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.
[nitpick] The hardcoded positioning logic with nested ternary operators is difficult to maintain. Consider using a position mapping object or array to make the positioning more readable and maintainable.
Copilot uses AI. Check for mistakes.
{sponsors | ||
.filter((sponsor) => sponsor.type === "Food Partner") | ||
.map((sponsor, index) => ( | ||
<div | ||
key={sponsor.name} | ||
className={`absolute floating-sponsor floating-sponsor-${ | ||
index + 2 | ||
}`} | ||
style={{ | ||
left: index === 0 ? "20%" : index === 1 ? "50%" : "80%", | ||
top: index === 0 ? "45%" : index === 1 ? "75%" : "40%", | ||
transform: "translate(-50%, -50%)", | ||
animationDelay: `${(index + 1) * 0.5}s`, | ||
}} | ||
> |
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.
[nitpick] Duplicate positioning logic from the sponsors section. This hardcoded positioning with nested ternary operators should be extracted into a shared utility function or configuration object to reduce code duplication.
{sponsors | |
.filter((sponsor) => sponsor.type === "Food Partner") | |
.map((sponsor, index) => ( | |
<div | |
key={sponsor.name} | |
className={`absolute floating-sponsor floating-sponsor-${ | |
index + 2 | |
}`} | |
style={{ | |
left: index === 0 ? "20%" : index === 1 ? "50%" : "80%", | |
top: index === 0 ? "45%" : index === 1 ? "75%" : "40%", | |
transform: "translate(-50%, -50%)", | |
animationDelay: `${(index + 1) * 0.5}s`, | |
}} | |
> | |
{/* | |
Extracted positioning for Food Partners. | |
If more partners are added, extend this array accordingly. | |
*/} | |
{(() => { | |
const foodPartnerPositions = [ | |
{ left: "20%", top: "45%" }, | |
{ left: "50%", top: "75%" }, | |
{ left: "80%", top: "40%" }, | |
]; | |
return sponsors | |
.filter((sponsor) => sponsor.type === "Food Partner") | |
.map((sponsor, index) => { | |
const pos = foodPartnerPositions[index] || { left: "50%", top: "50%" }; | |
return ( | |
<div | |
key={sponsor.name} | |
className={`absolute floating-sponsor floating-sponsor-${index + 2}`} | |
style={{ | |
left: pos.left, | |
top: pos.top, | |
transform: "translate(-50%, -50%)", | |
animationDelay: `${(index + 1) * 0.5}s`, | |
}} | |
> |
Copilot uses AI. Check for mistakes.
<style jsx>{` | ||
@keyframes float { | ||
0%, | ||
100% { | ||
transform: translate(-50%, -50%) translateY(0px); | ||
} | ||
50% { | ||
transform: translate(-50%, -50%) translateY(-20px); | ||
} | ||
} | ||
|
||
@keyframes floatReverse { | ||
0%, | ||
100% { | ||
transform: translate(-50%, -50%) translateY(0px); | ||
} | ||
50% { | ||
transform: translate(-50%, -50%) translateY(20px); | ||
} | ||
} | ||
|
||
@keyframes floatSlow { | ||
0%, | ||
100% { | ||
transform: translate(-50%, -50%) translateY(0px) rotate(0deg); | ||
} | ||
50% { | ||
transform: translate(-50%, -50%) translateY(-15px) rotate(5deg); | ||
} | ||
} | ||
|
||
.floating-sponsor { | ||
animation-duration: 3s; | ||
animation-iteration-count: infinite; | ||
animation-timing-function: ease-in-out; | ||
} | ||
|
||
.floating-sponsor-1 { | ||
animation-name: float; | ||
} | ||
|
||
.floating-sponsor-2 { | ||
animation-name: floatReverse; | ||
animation-duration: 4s; | ||
} | ||
|
||
.floating-sponsor-3 { | ||
animation-name: floatSlow; | ||
animation-duration: 5s; | ||
} | ||
|
||
.floating-sponsor-4 { | ||
animation-name: float; | ||
animation-duration: 3.5s; | ||
} | ||
|
||
@media (max-width: 768px) { | ||
.floating-sponsor { | ||
position: relative !important; | ||
left: auto !important; | ||
top: auto !important; | ||
transform: none !important; | ||
margin: 1rem auto; | ||
display: block; | ||
} | ||
} | ||
`}</style> |
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.
[nitpick] Using inline styles with styled-jsx in a Next.js component is not the recommended approach. Consider moving these styles to a CSS module, global CSS file, or using Tailwind CSS classes for better maintainability and performance.
<style jsx>{` | |
@keyframes float { | |
0%, | |
100% { | |
transform: translate(-50%, -50%) translateY(0px); | |
} | |
50% { | |
transform: translate(-50%, -50%) translateY(-20px); | |
} | |
} | |
@keyframes floatReverse { | |
0%, | |
100% { | |
transform: translate(-50%, -50%) translateY(0px); | |
} | |
50% { | |
transform: translate(-50%, -50%) translateY(20px); | |
} | |
} | |
@keyframes floatSlow { | |
0%, | |
100% { | |
transform: translate(-50%, -50%) translateY(0px) rotate(0deg); | |
} | |
50% { | |
transform: translate(-50%, -50%) translateY(-15px) rotate(5deg); | |
} | |
} | |
.floating-sponsor { | |
animation-duration: 3s; | |
animation-iteration-count: infinite; | |
animation-timing-function: ease-in-out; | |
} | |
.floating-sponsor-1 { | |
animation-name: float; | |
} | |
.floating-sponsor-2 { | |
animation-name: floatReverse; | |
animation-duration: 4s; | |
} | |
.floating-sponsor-3 { | |
animation-name: floatSlow; | |
animation-duration: 5s; | |
} | |
.floating-sponsor-4 { | |
animation-name: float; | |
animation-duration: 3.5s; | |
} | |
@media (max-width: 768px) { | |
.floating-sponsor { | |
position: relative !important; | |
left: auto !important; | |
top: auto !important; | |
transform: none !important; | |
margin: 1rem auto; | |
display: block; | |
} | |
} | |
`}</style> |
Copilot uses AI. Check for mistakes.
This pull request introduces a new "Sponsors" section to the homepage, visually highlighting both sponsors and food partners with animated logos and a thank-you message. The main changes involve importing and integrating the new
Sponsors
component into the homepage, and implementing the component itself with styled layouts and floating animations.Homepage integration:
Sponsors
component import tosrc/app/page.tsx
, and inserted a new section for sponsors between the prizes and contact sections. [1] [2]New Sponsors section implementation:
src/components/Sponsors.tsx
with: