Skip to content
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

Added Hovering effect to social icons in Footer issue -#2388 #2416

Closed
wants to merge 3 commits into from

Conversation

Mahimatestgithub
Copy link
Contributor

@Mahimatestgithub Mahimatestgithub commented Oct 29, 2024

image
Added hovering effect to 3 social icons- instagram , twitter and discord, earlier only 3 icons were showing hovering that were linkeldn ,facebook, whatsapp .

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a subscription feature on the home page, allowing users to sign up for a newsletter with feedback upon successful subscription.
    • Added a new section for social media links in the footer, enhancing connectivity with platforms like Instagram, Twitter, LinkedIn, Facebook, WhatsApp, and Discord.
  • Improvements

    • Enhanced footer styles with hover effects for social media icons and improved responsive design.
    • Added a custom shadow effect for visual enhancement of elements on the home page.
  • Bug Fixes

    • Adjusted layout and alignment of footer elements for better presentation.

Copy link

vercel bot commented Oct 29, 2024

@Mahimatestgithub is attempting to deploy a commit to the Vivek Prajapati's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Oct 29, 2024

Walkthrough

The changes in this pull request involve enhancements to the footer component and home page of the application. The footer now includes a new section for social media links with hover effects on icons, while the home page introduces a subscription feature with email input management. Additionally, new CSS styles are added for visual improvements, including a custom shadow effect for elements in the home page.

Changes

File Change Summary
src/User/components/Footer/Footer.css Added hover effects for social media icons, updated responsive design, and modified layout styles.
src/User/components/Footer/Footer.jsx Introduced a social media section with icons for various platforms, structured under a "SOCIALS" header.
src/User/pages/Home/Home.css Added a new .custom-shadow class for visual styling with box shadow and border radius.
src/User/pages/Home/Home.jsx Implemented a subscription feature with state management for email input and success message display.

Possibly related issues

Possibly related PRs

Suggested labels

hacktoberfest, hacktoberfest-accepted, gssoc

Poem

🐇 In the footer, icons gleam,
With hover effects, they dance and beam.
A subscription feature now takes flight,
Bringing users joy, day and night.
Shadows cast in a gentle way,
Enhancing the home page, come what may! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (7)
src/User/pages/Home/Home.css (2)

12-15: Consider enhancing the shadow implementation.

The shadow implementation looks good, but could be improved:

  1. The comment could be more descriptive about where this shadow is being applied
  2. Consider using CSS custom properties (variables) for the shadow values to maintain consistency
 .custom-shadow {
-    box-shadow: 0px 6px 20px rgba(60, 60, 60, 0.3); /* Dark gray, thick shadow */
+    /* Elevated card shadow for category cards */
+    box-shadow: 0px 6px 20px rgba(60, 60, 60, 0.3);
     border-radius: 8px;
 }

16-17: Remove extra blank lines.

There are unnecessary blank lines after the .custom-shadow class definition.

 .custom-shadow {
     box-shadow: 0px 6px 20px rgba(60, 60, 60, 0.3);
     border-radius: 8px;
 }
-  
-  
 @keyframes smoothUpDown {
src/User/components/Footer/Footer.jsx (4)

164-166: Remove extra empty lines

A single empty line is sufficient for visual separation between sections.

-
-

Line range hint 166-240: Standardize icon implementations for better consistency

The social media section has inconsistencies in:

  1. Icon libraries (mixing React Icons with Lord Icon)
  2. Icon sizes (varying between 25px-35px)
  3. Styling approaches (inline styles vs. direct props)

Consider standardizing the implementation:

 <div className="social-icons">
   <a
     href="https://www.instagram.com/vigybag/"
     target="_blank"
     rel="noopener noreferrer">
-    <FaInstagram size={30} style={{ color: "#E4405F" }} />
+    <FaInstagram size={30} className="social-icon instagram" />
   </a>
   <a
     href="https://www.x.com"
     target="_blank"
     rel="noopener noreferrer">
-    <BsTwitterX size={25} style={{ color: "#ffffff" }} />
+    <BsTwitterX size={30} className="social-icon twitter" />
   </a>
   <!-- Similar changes for other icons -->
 </div>

Then move all styling to CSS:

.social-icon {
  transition: transform 0.3s ease;
}
.social-icon:hover {
  transform: scale(1.1);
}
.social-icon.instagram { color: #E4405F; }
.social-icon.twitter { color: #ffffff; }
/* Add other icon-specific styles */

Line range hint 189-227: Add security attributes to external links

Some external links are missing the rel="noopener noreferrer" attribute, which is important for security when using target="_blank".

Add the missing attributes:

   <a
     href="https://www.linkedin.com/posts/codervivek_startup-teamwork-innovation-activity-7211097005408890880-haWJ?"
-    target="_blank">
+    target="_blank"
+    rel="noopener noreferrer">
     <lord-icon>...</lord-icon>
   </a>
   <a
     href="https://www.facebook.com/profile.php?id=61553496839072"
-    target="_blank">
+    target="_blank"
+    rel="noopener noreferrer">
     <lord-icon>...</lord-icon>
   </a>
   <a
-    href="https://web.whatsapp.com/"
-    target="_blank">
+    href="https://web.whatsapp.com/"
+    target="_blank"
+    rel="noopener noreferrer">
     <lord-icon>...</lord-icon>
   </a>

Line range hint 166-240: Enhance accessibility for social media links

The social media links lack proper accessibility attributes, making them difficult for screen reader users to understand.

Add descriptive aria-labels:

   <a
     href="https://www.instagram.com/vigybag/"
     target="_blank"
+    aria-label="Visit VigyBag on Instagram"
     rel="noopener noreferrer">
     <FaInstagram size={30} style={{ color: "#E4405F" }} />
   </a>
   <!-- Add similar aria-labels for other social links -->
src/User/pages/Home/Home.jsx (1)

Line range hint 312-344: Improve form accessibility and styling.

The current implementation uses inline styles and lacks proper accessibility features:

  1. Move inline styles to CSS classes
  2. Add proper ARIA attributes
  3. Enhance success message styling

Consider these improvements:

-<form onSubmit={handleSubscribe}>
+<form 
+  onSubmit={handleSubscribe}
+  className="newsletter-form"
+  aria-label="Newsletter subscription form"
+>
   <input
     type="email"
     placeholder="Enter your email address"
     value={email}
     onChange={(e) => setEmail(e.target.value)}
-    style={{
-      color: "black",
-      width: "100%",
-      borderRadius: "10px",
-      padding: "10px",
-      marginBottom: "10px",
-      border: "1px solid #ccc",
-    }}
+    className="newsletter-input"
+    aria-label="Email address"
+    required
   />
   <button
     type="submit"
-    style={{
-      backgroundColor: "#4CAF50",
-      color: "#fff",
-      padding: "10px 20px",
-      border: "none",
-      borderRadius: "5px",
-      cursor: "pointer",
-    }}
+    className="newsletter-submit"
+    aria-label="Subscribe to newsletter"
   >
     Subscribe
   </button>
 </form>
 {isSubscribed && (
-  <div className="popup-message">
+  <div 
+    className="success-message"
+    role="alert"
+    aria-live="polite"
+  >
     <p>Subscribed successfully!</p>
   </div>
 )}

Add these styles to your CSS file:

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.newsletter-input {
  color: black;
  width: 100%;
  border-radius: 0.625rem;
  padding: 0.625rem;
  border: 1px solid #ccc;
}

.newsletter-submit {
  background-color: #4CAF50;
  color: white;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.3125rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.newsletter-submit:hover {
  background-color: #45a049;
}

.success-message {
  margin-top: 1rem;
  padding: 0.75rem;
  background-color: #4CAF50;
  color: white;
  border-radius: 0.3125rem;
  text-align: center;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 91bca48 and b4485c3.

📒 Files selected for processing (4)
  • src/User/components/Footer/Footer.css (3 hunks)
  • src/User/components/Footer/Footer.jsx (1 hunks)
  • src/User/pages/Home/Home.css (1 hunks)
  • src/User/pages/Home/Home.jsx (6 hunks)
🔇 Additional comments (4)
src/User/pages/Home/Home.css (1)

12-15: Verify the relevance of these changes to the PR objective.

The PR description mentions adding hover effects to social icons in the Footer, but this file (Home.css) contains changes for adding shadows to elements on the Home page. Could you clarify if these changes are intentional and related to the PR objective?

src/User/components/Footer/Footer.css (1)

Line range hint 115-144: LGTM! Well-structured responsive design implementation.

The media query implementation follows good practices:

  • Mobile-first approach
  • Clear breakpoint at 768px
  • Logical layout transitions from column to row
  • Proper alignment adjustments for different screen sizes
src/User/components/Footer/Footer.jsx (1)

Line range hint 166-240: Verify hover effects implementation

The PR objective mentions adding hover effects to Instagram, Twitter, and Discord icons, but these effects should be defined in the CSS file.

Let's verify the hover effects implementation:

✅ Verification successful

Let me check the actual hover effect implementations in the CSS file to provide a complete verification.


Hover effects are properly implemented in CSS

The hover effects are correctly implemented in the Footer.css file with:

  • Smooth transitions using transition: transform 0.3s, filter 0.3s
  • Scale transform on hover: transform: scale(1.1)
  • Additional brightness/saturation effects for specific social icons
  • Clean separation of concerns with styles defined in CSS instead of inline
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if hover effects are properly defined in the CSS file
rg -l "hover" src/User/components/Footer/Footer.css

# Look for transition or transform properties
rg "(transition|transform)" src/User/components/Footer/Footer.css

Length of output: 256


Script:

#!/bin/bash
# Get the full context of hover-related CSS
rg -A 5 -B 5 "hover" src/User/components/Footer/Footer.css

Length of output: 911

src/User/pages/Home/Home.jsx (1)

138-140: LGTM: State variables properly initialized.

The new state variables for managing subscription state and email input are well-structured and follow React conventions.

Comment on lines +94 to +113
/* Social Media Icon Hover Effects */
.footer-top .social-icons a {
transition: transform 0.3s, filter 0.3s;
}

.footer-top .social-icons a:hover {
transform: scale(1.1);
}

.footer-top .social-icons a:nth-child(1):hover img {
filter: brightness(1.2) saturate(1.2);
}

.footer-top .social-icons a:nth-child(2):hover img {
filter: brightness(1.2) saturate(1.2);
}

.footer-top .social-icons a:nth-child(6):hover img {
filter: brightness(1.2) saturate(1.2);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Refactor hover effects to use more maintainable selectors.

The current implementation has several issues:

  1. Using nth-child selectors makes the code fragile if icon order changes
  2. Duplicate filter values across selectors
  3. Missing documentation for which social media each selector targets

Consider using this more maintainable approach:

- /* Social Media Icon Hover Effects */
+ /* Social Media Icon Hover Effects - Base styles */
.footer-top .social-icons a {
  transition: transform 0.3s, filter 0.3s;
}

.footer-top .social-icons a:hover {
  transform: scale(1.1);
}

- .footer-top .social-icons a:nth-child(1):hover img {
-   filter: brightness(1.2) saturate(1.2);
- }
-
- .footer-top .social-icons a:nth-child(2):hover img {
-   filter: brightness(1.2) saturate(1.2);
- }
-
- .footer-top .social-icons a:nth-child(6):hover img {
-   filter: brightness(1.2) saturate(1.2);
- }

+ /* Individual social media hover effects */
+ .footer-top .social-icons a[href*="instagram"]:hover img,
+ .footer-top .social-icons a[href*="twitter"]:hover img,
+ .footer-top .social-icons a[href*="discord"]:hover img {
+   filter: brightness(1.2) saturate(1.2);
+ }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/* Social Media Icon Hover Effects */
.footer-top .social-icons a {
transition: transform 0.3s, filter 0.3s;
}
.footer-top .social-icons a:hover {
transform: scale(1.1);
}
.footer-top .social-icons a:nth-child(1):hover img {
filter: brightness(1.2) saturate(1.2);
}
.footer-top .social-icons a:nth-child(2):hover img {
filter: brightness(1.2) saturate(1.2);
}
.footer-top .social-icons a:nth-child(6):hover img {
filter: brightness(1.2) saturate(1.2);
}
/* Social Media Icon Hover Effects - Base styles */
.footer-top .social-icons a {
transition: transform 0.3s, filter 0.3s;
}
.footer-top .social-icons a:hover {
transform: scale(1.1);
}
/* Individual social media hover effects */
.footer-top .social-icons a[href*="instagram"]:hover img,
.footer-top .social-icons a[href*="twitter"]:hover img,
.footer-top .social-icons a[href*="discord"]:hover img {
filter: brightness(1.2) saturate(1.2);
}

Comment on lines +103 to +113
.footer-top .social-icons a:nth-child(1):hover img {
filter: brightness(1.2) saturate(1.2);
}

.footer-top .social-icons a:nth-child(2):hover img {
filter: brightness(1.2) saturate(1.2);
}

.footer-top .social-icons a:nth-child(6):hover img {
filter: brightness(1.2) saturate(1.2);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

CSS selectors don't match the intended social icons

The current implementation has issues with the nth-child selectors:

  • Instagram is correctly targeted as nth-child(1)
  • Twitter/X is correctly targeted as nth-child(2)
  • Discord is nth-child(6), which is correct
  • However, the CSS is applying filter: brightness(1.2) saturate(1.2) to img elements, but the icons are implemented using FaInstagram, BsTwitterX, and FaDiscord components, not images

The hover effects won't work because:

  1. The selectors target img elements that don't exist
  2. The icons are rendered as SVG components, not images
🔗 Analysis chain

Verify hover effects target the correct social icons.

The current implementation uses nth-child selectors (1, 2, and 6), but it's unclear if these correspond to Instagram, Twitter, and Discord icons as mentioned in the PR objectives.

Let's verify the icon order in the JSX file:


Let me gather more information to see the complete social icons implementation:


Let me check the complete social icons section to see all icons:


Let me get the complete list of social icons to verify all entries:


Let me get one final check to see if there are any more social icons:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Find and display the social icons implementation in Footer.jsx
rg -l "Footer" --type jsx | xargs rg -A 10 "social-icons"

Length of output: 3392


Script:

#!/bin/bash
# Find all social icon links in Footer.jsx
rg -A 5 "social-icons" src/User/components/Footer/Footer.jsx

Length of output: 324


Script:

#!/bin/bash
# Get more context around social icons section
rg -B 2 -A 20 "social-icons" src/User/components/Footer/Footer.jsx

Length of output: 951


Script:

#!/bin/bash
# Get the complete social icons section including all icon entries
rg -B 2 -A 40 "social-icons" src/User/components/Footer/Footer.jsx

Length of output: 1663


Script:

#!/bin/bash
# Get an even larger context to ensure we see all social icons
rg -B 2 -A 60 "social-icons" src/User/components/Footer/Footer.jsx

Length of output: 2347

Comment on lines +167 to +175
const handleSubscribe = (e) => {
e.preventDefault();
setIsSubscribed(true); // Show the success message
setTimeout(() => {
setIsSubscribed(false); // Hide the message
setEmail(""); // Clear the email input
}, 3000); // 3 seconds
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add proper form validation and error handling.

The current implementation has several potential issues:

  1. Missing email validation
  2. No error handling
  3. No actual subscription logic (API call)
  4. Timeout-based state reset could cause race conditions if user submits multiple times

Consider implementing this improved version:

-const handleSubscribe = (e) => {
+const handleSubscribe = async (e) => {
   e.preventDefault();
+  if (!email || !email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) {
+    // Show error message
+    return;
+  }
+  try {
+    // Add loading state if needed
+    // await subscribeUser(email);
     setIsSubscribed(true);
-    setTimeout(() => {
-      setIsSubscribed(false);
-      setEmail("");
-    }, 3000);
+    setEmail("");
+    // Reset subscription state after delay, but only if still subscribed
+    const timeoutId = setTimeout(() => {
+      setIsSubscribed((current) => current ? false : current);
+    }, 3000);
+    // Clean up timeout if component unmounts
+    return () => clearTimeout(timeoutId);
+  } catch (error) {
+    // Handle error appropriately
+    console.error('Subscription failed:', error);
+  }
 };

Committable suggestion was skipped due to low confidence.

Comment on lines +235 to +242
<div key={index} className="custom-shadow">
<CategoryCard
key={index}
name={category.name}
image={category.image}
path={category.path}
/>
</div>
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix duplicate key prop and verify layout impact.

  1. The key prop is unnecessarily duplicated on both the wrapper div and the CategoryCard
  2. Adding a wrapper div might affect the grid layout spacing

Apply this fix:

-<div key={index} className="custom-shadow">
-<CategoryCard
-  key={index}
-  name={category.name}
-  image={category.image}
-  path={category.path}
-/>
-</div>
+<CategoryCard
+  key={index}
+  className="custom-shadow"
+  name={category.name}
+  image={category.image}
+  path={category.path}
+/>

Please verify that this change doesn't break the shadow effect. If CategoryCard doesn't accept a className prop, you'll need to modify it to support this.

Committable suggestion was skipped due to low confidence.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take a look of code rabbit review and fix it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codervivek5, glad to see that you're addressing the feedback. Please let me know if you need any further assistance.

🐰😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants