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

Add glow hover effect to the main page #1030

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

IPogorelova
Copy link
Contributor

@IPogorelova IPogorelova commented Jan 25, 2025

This PR introduces a new component, GlowHoverCard, which copies Card with a glowing cursor effect.
Issue: #987

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced GlowHoverCard component with interactive hover effects.
    • Added hover effect to hero video overlay button.
  • Improvements

    • Enhanced card rendering in the Approach section with new glowing hover interaction.
    • Updated import paths for better project structure.
    • Improved type safety and flexibility of the useGlowHover hook.
  • UI Updates

    • Refined component styling with new hover state behaviors.

Copy link

vercel bot commented Jan 25, 2025

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

Name Status Preview Comments Updated (UTC)
public ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 25, 2025 4:59pm

Copy link

coderabbitai bot commented Jan 25, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a new GlowHoverCard component and updates several files to incorporate hover effects and modify component imports. The changes primarily focus on enhancing UI interaction with a glowing hover effect, updating import paths, and consolidating component exports.

Changes

File Change Summary
ui/src/components/card/card.tsx Updated import path for cn utility function
ui/src/components/card/glow-hover-card.tsx Added new GlowHoverCard React component with hover effect
ui/src/components/card/index.ts Added export statements for card and glow-hover-card modules
website/src/app/[lang]/[region]/(website)/(home)/(components)/hero-video-overlay.tsx Added useGlowHover hook to button
website/src/app/[lang]/[region]/(website)/(home)/(sections)/approach.tsx Replaced Card with GlowHoverCard
ui/src/components/use-glow-hover/glow-hover-effect.ts Updated glowHoverEffect function to accept generic type parameter
ui/src/components/use-glow-hover/use-glow-hover.ts Modified useGlowHover hook to use generic type parameter

Possibly related PRs

  • Website: Implement glowing cursor effect #1009: The changes in this PR introduce the GlowHoverContainer component, which utilizes the useGlowHover hook, directly related to the modifications in the main PR that involve the useGlowHover functionality.

Suggested labels

website

Suggested reviewers

  • mkue
  • socialincome-dev
  • ssandino
  • DarkMenacer

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4845002 and 0f1975c.

📒 Files selected for processing (2)
  • ui/src/components/use-glow-hover/use-glow-hover.ts (1 hunks)
  • website/src/app/[lang]/[region]/(website)/(home)/(components)/hero-video-overlay.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • ui/src/components/use-glow-hover/use-glow-hover.ts
  • website/src/app/[lang]/[region]/(website)/(home)/(components)/hero-video-overlay.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test website
  • GitHub Check: Prettify

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

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

🧹 Nitpick comments (2)
ui/src/components/card/glow-hover-card.tsx (1)

8-14: Make light color configurable via props.

The light color is hardcoded to '#CEFF00', which limits component reusability. Consider accepting it as a prop with a default value.

-export const GlowHoverCard = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }) => {
+type GlowHoverCardProps = React.HTMLAttributes<HTMLDivElement> & {
+  lightColor?: string;
+};
+
+export const GlowHoverCard = React.forwardRef<HTMLDivElement, GlowHoverCardProps>(
+  ({ className, lightColor = '#CEFF00', ...props }) => {
-  const refCard = useGlowHover({ lightColor: '#CEFF00' });
+  const refCard = useGlowHover({ lightColor });
website/src/app/[lang]/[region]/(website)/(home)/(sections)/approach.tsx (1)

27-27: Resolve conflicting border styles.

The border-none class conflicts with border-2 from GlowHoverCard's base styles. Consider handling borders consistently.

-<GlowHoverCard key={card.title} className="theme-blue mx-auto min-w-80 max-w-md flex-1 rounded-none border-none">
+<GlowHoverCard key={card.title} className="theme-blue mx-auto min-w-80 max-w-md flex-1 rounded-none">
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54f4eaf and 35445ab.

📒 Files selected for processing (5)
  • ui/src/components/card/card.tsx (1 hunks)
  • ui/src/components/card/glow-hover-card.tsx (1 hunks)
  • ui/src/components/card/index.ts (1 hunks)
  • website/src/app/[lang]/[region]/(website)/(home)/(components)/hero-video-overlay.tsx (3 hunks)
  • website/src/app/[lang]/[region]/(website)/(home)/(sections)/approach.tsx (3 hunks)
✅ Files skipped from review due to trivial changes (2)
  • ui/src/components/card/index.ts
  • ui/src/components/card/card.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Test website
  • GitHub Check: Prettify
  • GitHub Check: Security checks (typescript)
🔇 Additional comments (1)
website/src/app/[lang]/[region]/(website)/(home)/(components)/hero-video-overlay.tsx (1)

21-21: Ensure color consistency and verify text contrast.

Two suggestions:

  1. Use the same light color from a shared constant
  2. Verify that black text maintains sufficient contrast against the glowing background

Also applies to: 56-58

…n-page' into add-glow-hover-effect-to-the-main-page

# Conflicts:
#	ui/src/components/card/glow-hover-card.tsx
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: 0

🧹 Nitpick comments (2)
ui/src/components/use-glow-hover/glow-hover-effect.ts (2)

50-50: Type enhancement looks good but consider performance optimizations

The generic type parameter addition is well-aligned with the hook changes. However, consider these performance improvements:

  1. Debounce mouse move events
  2. Use CSS transforms instead of direct style manipulation
  3. Cache computed values

Example debounce implementation:

const debouncedOnMouseMove = debounce((e: MouseEvent) => {
  lastMousePos = { x: e.clientX, y: e.clientY };
  if (isElementMovable) {
    updateEffectWithPosition();
  } else {
    updateGlowEffect();
  }
}, 16); // ~60fps

Line range hint 50-214: Consider adding error boundaries

The complex animation logic could benefit from error handling to prevent potential runtime crashes.

try {
  updateGlowEffect();
} catch (error) {
  console.error('Failed to update glow effect:', error);
  // Fallback to default state
  el.style.background = customStaticBg ? customStaticBg : '';
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 393c0ca and 4845002.

📒 Files selected for processing (3)
  • ui/src/components/use-glow-hover/glow-hover-effect.ts (1 hunks)
  • ui/src/components/use-glow-hover/use-glow-hover.ts (1 hunks)
  • website/src/app/[lang]/[region]/(website)/(home)/(components)/hero-video-overlay.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • website/src/app/[lang]/[region]/(website)/(home)/(components)/hero-video-overlay.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Test website
  • GitHub Check: Prettify
  • GitHub Check: Security checks (typescript)
🔇 Additional comments (2)
ui/src/components/use-glow-hover/use-glow-hover.ts (2)

3-3: Type safety improvements look good!

The generic type parameter and RefObject typing enhance type safety while maintaining flexibility.

Also applies to: 8-9


12-12: Verify type casting necessity

The type casting of options might be unnecessary since GlowHoverOptions is already defined in the parameter type.

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

Successfully merging this pull request may close these issues.

1 participant