-
Notifications
You must be signed in to change notification settings - Fork 322
Add Gradient Glow Hover Effect to Project Cards #500
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
base: main
Are you sure you want to change the base?
Conversation
|
@Riyanshverma is attempting to deploy a commit to the AOSSIE Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughEnhanced the Card component in projects page by adding Tailwind CSS utilities for interactive hover effects, including smooth transitions, scale transformation, and shadow changes in both light and dark modes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pages/projects.jsx (1)
36-42: Border color conflict between Tailwind and MUI styles.The
dark:border-whiteclass on line 36 conflicts with theborderColor: '#3c982c'set in thesxprop on line 41. MUI'ssxprop typically has higher CSS specificity, so the border will likely remain green in dark mode, rendering the Tailwind class ineffective.Apply this diff to remove the redundant class:
- className={`dark:bg-[#2A2A2A] dark:border-white group transition-all duration-300 ease-in-out hover:scale-105 hover:shadow-[0_0_15px_3px_rgba(50,168,82,0.7),0_0_48px_8px_rgba(255,255,0,0.2)] dark:hover:shadow-[0_0_15px_3px_rgba(255,255,0,0.7),0_0_48px_8px_rgba(50,168,82,0.2)]`} + className={`dark:bg-[#2A2A2A] group transition-all duration-300 ease-in-out hover:scale-105 hover:shadow-[0_0_15px_3px_rgba(50,168,82,0.7),0_0_48px_8px_rgba(255,255,0,0.2)] dark:hover:shadow-[0_0_15px_3px_rgba(255,255,0,0.7),0_0_48px_8px_rgba(50,168,82,0.2)]`}Alternatively, if you want a white border in dark mode, set it via the
sxprop instead:sx={{ height: 400, borderRadius: 2, border: '1px solid', - borderColor: '#3c982c', + borderColor: { xs: '#3c982c', dark: 'white' },
🧹 Nitpick comments (2)
src/pages/projects.jsx (2)
36-46: Consider consolidating to a single styling approach.The Card component mixes Tailwind utilities in
classNamewith MUI'ssxprop, which can lead to style conflicts (as seen with the border) and make the component harder to maintain. While both approaches work, consolidating styles improves consistency and reduces debugging complexity.Option 1: Move all styles to MUI
sxprop:<MuiCard - className={`dark:bg-[#2A2A2A] dark:border-white group transition-all duration-300 ease-in-out hover:scale-105 hover:shadow-[0_0_15px_3px_rgba(50,168,82,0.7),0_0_48px_8px_rgba(255,255,0,0.2)] dark:hover:shadow-[0_0_15px_3px_rgba(255,255,0,0.7),0_0_48px_8px_rgba(50,168,82,0.2)]`} sx={{ height: 400, borderRadius: 2, border: '1px solid', borderColor: '#3c982c', boxShadow: '0px 4px 4px #00000040', backdropFilter: 'blur(4px) brightness(100%)', display: 'flex', flexDirection: 'column', + bgcolor: { dark: '#2A2A2A' }, + transition: 'all 0.3s ease-in-out', + '&:hover': { + transform: 'scale(1.05)', + boxShadow: '0 0 15px 3px rgba(50,168,82,0.7), 0 0 48px 8px rgba(255,255,0,0.2)', + '.dark &': { + boxShadow: '0 0 15px 3px rgba(255,255,0,0.7), 0 0 48px 8px rgba(50,168,82,0.2)', + }, + }, }} >Option 2: Extract hover styles to a constant for readability while keeping Tailwind.
36-36: Extract long className to a constant for readability.The 247-character className string on line 36 reduces readability. Consider extracting it to a named constant.
+const cardHoverClasses = ` + dark:bg-[#2A2A2A] + group + transition-all duration-300 ease-in-out + hover:scale-105 + hover:shadow-[0_0_15px_3px_rgba(50,168,82,0.7),0_0_48px_8px_rgba(255,255,0,0.2)] + dark:hover:shadow-[0_0_15px_3px_rgba(255,255,0,0.7),0_0_48px_8px_rgba(50,168,82,0.2)] +`.replace(/\s+/g, ' ').trim(); + // Define the Cards component here const Cards = () => { const router = useRouter();Then use it:
- className={`dark:bg-[#2A2A2A] dark:border-white group transition-all duration-300 ease-in-out hover:scale-105 hover:shadow-[0_0_15px_3px_rgba(50,168,82,0.7),0_0_48px_8px_rgba(255,255,0,0.2)] dark:hover:shadow-[0_0_15px_3px_rgba(255,255,0,0.7),0_0_48px_8px_rgba(50,168,82,0.2)]`} + className={cardHoverClasses}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/pages/projects.jsx(1 hunks)
🔇 Additional comments (1)
src/pages/projects.jsx (1)
36-36: Verify hover effect behavior on touch devices.The hover effects (scale and glow) may not provide the intended user experience on mobile/tablet devices where hover states are triggered by tap rather than pointer movement. Users on touch devices might see a brief flash of the effect or miss it entirely.
Test the effect on mobile devices and consider wrapping hover-specific styles in a
@media (hover: hover)query to only apply them on devices with true hover capability:- className={`dark:bg-[#2A2A2A] dark:border-white group transition-all duration-300 ease-in-out hover:scale-105 hover:shadow-[0_0_15px_3px_rgba(50,168,82,0.7),0_0_48px_8px_rgba(255,255,0,0.2)] dark:hover:shadow-[0_0_15px_3px_rgba(255,255,0,0.7),0_0_48px_8px_rgba(50,168,82,0.2)]`} + className={`dark:bg-[#2A2A2A] dark:border-white group transition-all duration-300 ease-in-out md:hover:scale-105 md:hover:shadow-[0_0_15px_3px_rgba(50,168,82,0.7),0_0_48px_8px_rgba(255,255,0,0.2)] dark:md:hover:shadow-[0_0_15px_3px_rgba(255,255,0,0.7),0_0_48px_8px_rgba(50,168,82,0.2)]`}Or test with Tailwind's
@media (hover: hover)support if configured in your project.
Summary
This PR implements a visually appealing "glow on hover" effect for the project cards on the Projects page. The effect combines a gradient box shadow and a slight scale-up transformation, with colors sourced from the existing website theme to ensure consistency in both light and dark modes.
Details
Screenshots
Related Issue
Closes #461
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.