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 Perspective Hover Effect for Popular Board Games Card and Code cleanup : Issue no #106 #117

Merged
merged 3 commits into from
Oct 7, 2024

Conversation

AbhijitMotekar99
Copy link
Contributor

@AbhijitMotekar99 AbhijitMotekar99 commented Oct 6, 2024

I added hover effects, and I also cleaned up the register.jsx and boardgame.jsx code for the cards using the map method to make it shorter.

Perspective.hover.enhanced.mp4
perspective.2.mp4

Summary by CodeRabbit

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced visual effects with new hover interactions on board game cards and dynamic rendering of game data.
    • Introduction of new CSS styles for improved aesthetics, including glow effects, text outlines, and custom scrollbar styles.
  • Bug Fixes

    • Streamlined rendering logic in the Register and Boardgame components for better performance.
  • Documentation

    • Updated styles and component structures to improve maintainability and user experience.

Copy link

vercel bot commented Oct 6, 2024

@AbhijitMotekar99 is attempting to deploy a commit to the bunty's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

coderabbitai bot commented Oct 6, 2024

Walkthrough

The changes in this pull request involve significant updates to the CSS and JavaScript components of the frontend application. New CSS classes are added to enhance styling and hover effects, while the Boardgame and Register components are refactored to utilize arrays for dynamic rendering of board game cards. This improves maintainability and user interaction through hover effects and visual feedback.

Changes

File Change Summary
frontend/src/App.css New classes added: .perspective, .glow-effect, .glow-effect:hover, .group:hover.
frontend/src/components/Pages/Boardgame.jsx Refactored to use dynamic rendering of board game cards with hover effects.
frontend/src/components/Pages/Register.jsx Refactored to use an array for dynamic rendering of popular board games with hover effects.
frontend/src/index.css New classes added: .font-outline-2, .Poppins, .primary-btn, .page-shadow.

Possibly related issues

Possibly related PRs

Suggested labels

enhancement, level 2, gssoc-ext, checked

Suggested reviewers

  • RamakrushnaBiswal

🐰 In a world of colors bright,
CSS changes bring delight,
With hover effects that glow,
Board games dance, put on a show!
Dynamic cards, a joyful sight,
Let’s play together, day and night! 🎲✨


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

github-actions bot commented Oct 6, 2024

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

Copy link

@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 (13)
frontend/src/App.css (3)

26-32: LGTM: Glow effect enhances UI and provides user feedback.

The .glow-effect class and its hover state create an engaging visual effect that aligns well with the PR's objective of adding hover effects to game cards.

Consider using CSS custom properties (variables) for the shadow values to make future adjustments easier. Here's a suggested refactor:

+:root {
+  --glow-shadow: 0 0 10px rgba(63, 63, 63, 0.5), 0 0 20px rgba(72, 72, 72, 0.3);
+  --glow-shadow-hover: 0 0 20px rgba(55, 56, 26, 0.7), 0 0 30px rgba(255, 239, 69, 0.5);
+}

 .glow-effect {
-  box-shadow: 0 0 10px rgba(63, 63, 63, 0.5), 0 0 20px rgba(72, 72, 72, 0.3);
+  box-shadow: var(--glow-shadow);
 }
 
 .glow-effect:hover {
-  box-shadow: 0 0 20px rgba(55, 56, 26, 0.7), 0 0 30px rgba(255, 239, 69, 0.5);
+  box-shadow: var(--glow-shadow-hover);
 }

38-40: LGTM: Group hover effect enhances UI.

The .group:hover class adds a subtle border color change on hover, which provides additional visual feedback and aligns with the PR's objective of enhancing hover effects.

Consider using a CSS custom property for the border color to maintain consistency with other hover effects:

+:root {
+  --hover-border-color: rgba(143, 143, 143, 0.5);
+}

 .group:hover {
-  border-color: rgba(143, 143, 143, 0.5);
+  border-color: var(--hover-border-color);
 }

Line range hint 1-41: Improve code formatting for consistency.

The overall structure of the file is good, with new classes appropriately added at the end. However, there are some inconsistencies in indentation and spacing that could be improved for better readability.

Please consider the following formatting improvements:

  1. Ensure consistent indentation (2 or 4 spaces) throughout the file.
  2. Remove extra blank lines (e.g., lines 20-21).
  3. Ensure consistent spacing around brackets and braces.

You can use a CSS formatter like Prettier to automatically apply consistent formatting to your CSS files.

frontend/src/index.css (6)

Line range hint 9-12: Consider improving cross-browser compatibility and naming convention.

The .font-outline-2 class uses the -webkit-text-stroke property, which is not supported in all browsers. Consider using a cross-browser solution or providing fallbacks.

Additionally, consider adopting a more descriptive class name following BEM naming convention, such as .text-outline--white-2px.

Here's an improved version:

.text-outline--white-2px {
    -webkit-text-stroke: 2px white;
    text-stroke: 2px white;
    text-shadow:
        -2px -2px 0 #fff,
        2px -2px 0 #fff,
        -2px 2px 0 #fff,
        2px 2px 0 #fff;
}

Line range hint 14-16: Improve class naming and Tailwind usage.

The .Poppins class doesn't follow conventional CSS naming (lowercase). Consider renaming it to .poppins-font for consistency. Also, consider using Tailwind's @apply directive and placing it within an appropriate @layer for better organization.

Here's an improved version:

@layer utilities {
    .poppins-font {
        @apply font-['Poppins',_sans-serif];
    }
}

Line range hint 20-26: Reconsider .primary-btn implementation and .page-shadow placement.

The .primary-btn class only applies block, which seems incomplete for a primary button style. Consider expanding this class with more styles or removing it if unnecessary.

The .page-shadow class applies a complex shadow effect. Consider moving this to the @layer utilities section as it's more of a utility class than a component.

Here's a suggested improvement:

@layer components {
    .primary-btn {
        @apply block px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors;
    }
}

@layer utilities {
    .page-shadow {
        @apply shadow-[inset_0_0_8px_rgba(0,0,0,0.6),12px_12px_14px_rgba(0,0,0,0.9)];
    }
}

Line range hint 31-44: Improve scrollbar styles for cross-browser compatibility and consistency.

The current scrollbar styles are only applicable to webkit browsers. Consider using a cross-browser solution or providing fallbacks for better compatibility.

Also, the use of beige color for the scrollbar might not be consistent with the overall color scheme of the application. Consider using a color variable or a Tailwind color class for better maintainability and consistency.

Here's a suggested improvement using CSS variables for colors:

:root {
    --scrollbar-bg: theme('colors.gray.200');
    --scrollbar-thumb: theme('colors.gray.400');
    --scrollbar-thumb-hover: theme('colors.gray.600');
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-bg);
}

::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-bg);
}

::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
}

45-46: Remove extra empty line at the end of the file.

It's good practice to end a file with a single newline character. Consider removing one of the two empty lines at the end of the file.


Line range hint 1-46: Overall code review summary

The changes introduce new styles and components that enhance the UI. However, there are several areas for improvement:

  1. Cross-browser compatibility for text outline and scrollbar styles.
  2. Consistency in naming conventions (e.g., .Poppins class).
  3. Better utilization of Tailwind's @layer and @apply directives.
  4. Reconsideration of component vs utility classes.
  5. Color consistency and use of CSS variables or Tailwind color classes.

Addressing these points will improve the maintainability and consistency of the stylesheet.

frontend/src/components/Pages/Boardgame.jsx (4)

91-91: Add apostrophe in "team's" for possessive form.

In the description for "Codenames" at line 91, "your teams secret code words" should use an apostrophe to indicate possession:

  • Change "your teams secret code words" to "your team's secret code words".

135-137: Avoid using href="#" to prevent unintended page jumps.

At lines 135-137, the anchor tag uses href="#":

<a className="absolute inset-0 z-10" href="#">
  <span className="sr-only">View</span>
</a>

Using href="#" can cause the page to scroll to the top when clicked. Consider the following alternatives:

  • Use href="/" to link to the homepage.
  • Use href="" or href="javascript:void(0);" to prevent default behavior.
  • Use a button element styled as a link if the anchor does not navigate.

150-151: Review inline styles for cross-browser compatibility and redundancy.

At lines 150-151, the img tag includes inline styles:

style={{ aspectRatio: "500 / 400", objectFit: "cover" }}
  • The aspect-ratio CSS property is not fully supported in all browsers. Consider using a wrapper with a fixed aspect ratio or using padding techniques for better compatibility.
  • The objectFit: "cover" style is redundant since the object-cover class already applies object-fit: cover;.

To improve compatibility and reduce redundancy, you might:

  • Remove the inline objectFit style.
  • Implement a fallback for the aspect-ratio property.

130-130: Consider using a unique identifier for the key prop instead of the index.

At line 130, the key prop is set to the index:

key={index}

Using the index as a key can lead to issues if the list items are reordered or data changes dynamically. If each board game has a unique identifier (e.g., id), consider using it:

key={board.id}

This enhances performance and ensures the correct handling of components in React's reconciliation process.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 49c1bfe and edfb99e.

📒 Files selected for processing (4)
  • frontend/src/App.css (1 hunks)
  • frontend/src/components/Pages/Boardgame.jsx (2 hunks)
  • frontend/src/components/Pages/Register.jsx (1 hunks)
  • frontend/src/index.css (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
frontend/src/App.css (1)

19-19: LGTM: Background color change enhances UI.

The new background color (#F1EADC) provides a warm, neutral backdrop for the application, which aligns well with the PR's objective of enhancing the user interface.

frontend/src/components/Pages/Register.jsx (1)

145-172: Excellent refactoring of board game cards!

The refactoring of the board game cards into a dynamic rendering using an array and map function is a great improvement. It enhances code maintainability, reduces redundancy, and makes it easier to update the game list in the future.

The addition of the hover effect with the glow is a nice touch that improves user interaction and visual appeal.

Great job on this refactoring! The code is now more maintainable and scalable.

Comment on lines 22 to 24
perspective: 1000px; /* Adjust the value as needed */
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove duplicate .perspective class definition.

The .perspective class is a good addition for creating 3D-positioned elements, which aligns with the PR's goal of adding hover effects. However, the class is defined twice with the same value.

Please remove the duplicate definition. Apply this diff:

 .perspective {
   perspective: 1000px; /* Adjust the value as needed */
 }

-  .perspective {
-    perspective: 1000px;
-  }

Also applies to: 34-36

frontend/src/components/Pages/Register.jsx Show resolved Hide resolved
frontend/src/components/Pages/Register.jsx Show resolved Hide resolved
frontend/src/components/Pages/Boardgame.jsx Outdated Show resolved Hide resolved
@RamakrushnaBiswal
Copy link
Owner

@AbhijitMotekar99 1st video hover effect doesn't look good

@AbhijitMotekar99
Copy link
Contributor Author

Hey @RamakrushnaBiswal
I will change it.

@AbhijitMotekar99
Copy link
Contributor Author

Hey @RamakrushnaBiswal
I changed hover effect and also enhanced overall card UI.

Copy link

@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: 1

🧹 Outside diff range and nitpick comments (1)
frontend/src/components/Pages/Boardgame.jsx (1)

Line range hint 74-101: Enhance form handling and accessibility for newsletter subscription.

While the newsletter subscription section is well-structured, consider the following improvements to enhance user experience and accessibility:

  1. Add form submission handling to prevent page reload and provide user feedback.
  2. Implement form validation for the email input.
  3. Add appropriate ARIA attributes and labels for better screen reader support.
  4. Consider adding a loading state to the submit button during form submission.

Here's a suggested implementation:

import React, { useState } from 'react';

// ... (rest of the imports)

export default function Boardgame() {
    const [email, setEmail] = useState('');
    const [isSubmitting, setIsSubmitting] = useState(false);
    const [submitMessage, setSubmitMessage] = useState('');

    const handleSubmit = async (e) => {
        e.preventDefault();
        setIsSubmitting(true);
        // Implement your form submission logic here
        // For example:
        // await submitNewsletter(email);
        setSubmitMessage('Thank you for subscribing!');
        setIsSubmitting(false);
        setEmail('');
    };

    return (
        // ... (rest of the component)

        <section className="w-full py-12 md:py-24 lg:py-32 bg-gray-100">
            <div className="container mx-auto px-4 md:px-6 text-center">
                <h2 className="text-3xl font-bold tracking-tight sm:text-4xl md:text-5xl lg:text-6xl mb-4">
                    Subscribe to our Newsletter
                </h2>
                <p className="mx-auto max-w-[700px] text-muted-foreground md:text-xl mb-6">
                    Stay updated with our latest boardgame collections, special offers, and events. Subscribe now and never miss out!
                </p>
                <form onSubmit={handleSubmit} className="flex flex-col items-center space-y-4 sm:space-y-0 sm:flex-row sm:space-x-4 justify-center">
                    <label htmlFor="email" className="sr-only">Email address</label>
                    <input
                        id="email"
                        type="email"
                        value={email}
                        onChange={(e) => setEmail(e.target.value)}
                        className="px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500"
                        placeholder="Enter your email"
                        required
                        aria-required="true"
                    />
                    <button
                        type="submit"
                        disabled={isSubmitting}
                        className="px-6 py-2 text-white bg-blue-600 rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50"
                        aria-live="polite"
                    >
                        {isSubmitting ? 'Subscribing...' : 'Subscribe'}
                    </button>
                </form>
                {submitMessage && (
                    <p className="mt-4 text-green-600" aria-live="polite">{submitMessage}</p>
                )}
            </div>
        </section>

        // ... (rest of the component)
    );
}

This implementation adds form state management, submission handling, and improved accessibility features.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between edfb99e and afe0968.

📒 Files selected for processing (2)
  • frontend/src/App.css (1 hunks)
  • frontend/src/components/Pages/Boardgame.jsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/App.css
🧰 Additional context used
🔇 Additional comments (2)
frontend/src/components/Pages/Boardgame.jsx (2)

Line range hint 1-101: Overall assessment: Improved code structure with room for enhancements.

The changes made to the Boardgame component significantly improve code maintainability and scalability. The use of an array and map function for rendering board game cards is a positive step. However, there are areas that require attention:

  1. Address the duplicate entries for the "Azul" game.
  2. Enhance accessibility throughout the component, especially in the board game cards and newsletter form.
  3. Implement proper form handling for the newsletter subscription.
  4. Consider moving inline styles to CSS classes for better maintainability.

These improvements will further enhance the quality and user experience of the component.


43-73: ⚠️ Potential issue

Improved code structure using array and map function.

The use of an array to store board game data and the map function to render them dynamically is a significant improvement. This approach enhances code maintainability and scalability, making it easier to add or remove board games in the future.

Address duplicate entries for the game "Azul".

There are multiple entries for the game "Azul" with different image sources but identical titles and descriptions. This appears to be unintentional and needs to be corrected.

Please review and update the entries for board6, board7, and board8 to reflect the correct board games or remove the duplicates if they are not needed.

frontend/src/components/Pages/Boardgame.jsx Show resolved Hide resolved
Copy link

vercel bot commented Oct 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
play-cafe ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 0:31am

@RamakrushnaBiswal
Copy link
Owner

@AbhijitMotekar99 lgtm :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gssoc-ext gssoc-extd program level1 for 10 points
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants