Skip to content

fix: prevent button clipping on hover in Hero section#140

Open
MD-Mushfiqur123 wants to merge 1 commit into
StabilityNexus:mainfrom
MD-Mushfiqur123:fix/button-clip-hover
Open

fix: prevent button clipping on hover in Hero section#140
MD-Mushfiqur123 wants to merge 1 commit into
StabilityNexus:mainfrom
MD-Mushfiqur123:fix/button-clip-hover

Conversation

@MD-Mushfiqur123

@MD-Mushfiqur123 MD-Mushfiqur123 commented May 22, 2026

Copy link
Copy Markdown

Closes #139

Removes overflow-hidden from the Hero section's parent motion.div which was clipping the CTA buttons when they scale up (via framer-motion whileHover: scale 1.05).

Summary by CodeRabbit

  • Style
    • Adjusted the Hero section's overflow display behavior.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown

Walkthrough

The Hero component's root animated container was simplified by removing the overflow-hidden CSS class, keeping only relative. This change allows child button elements to display fully during hover interactions without clipping at container boundaries.

Changes

Hero overflow-hidden removal

Layer / File(s) Summary
Remove overflow-hidden from Hero root container
src/lib/components/blocks/home/Hero.tsx
The root motion.div className was changed from overflow-hidden relative to relative, eliminating the constraint that clipped button content during hover states.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

Typescript Lang

Poem

A button that clips is a button in pain,
So off with overflow and out of the chain! 🐰
Now relative rules what was hidden before,
And hovers reveal what they couldn't explore. ✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: prevent button clipping on hover in Hero section' accurately describes the main change: removing overflow-hidden to fix button clipping issues.
Linked Issues check ✅ Passed The PR directly addresses issue #139 by removing the overflow-hidden class that was causing button clipping on hover, allowing the scale animation to display properly.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to the Hero component's motion.div container, directly addressing the button clipping issue without introducing unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/lib/components/blocks/home/Hero.tsx

Oops! Something went wrong! :(

ESLint: 9.30.0

TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'configs' -> object with constructor 'Object'
| property 'flat' -> object with constructor 'Object'
| ...
| property 'plugins' -> object with constructor 'Object'
--- property 'react' closes the circle
Referenced from:
at JSON.stringify ()
at file:///node_modules/@eslint/eslintrc/lib/shared/config-validator.js:308:45
at Array.map ()
at ConfigValidator.formatErrors (file:///node_modules/@eslint/eslintrc/lib/shared/config-validator.js:299:23)
at ConfigValidator.validateConfigSchema (file:///node_modules/@eslint/eslintrc/lib/shared/config-validator.js:330:84)
at ConfigArrayFactory._normalizeConfigData (file:///node_modules/@eslint/eslintrc/lib/config-array-factory.js:676:19)
at ConfigArrayFactory._loadConfigData (file:///node_modules/@eslint/eslintrc/lib/config-array-factory.js:641:21)
at ConfigArrayFactory._loadExtendedShareableConfig (file:///node_modules/@eslint/eslintrc/lib/config-array-factory.js:946:21)
at ConfigArrayFactory._loadExtends (file:///node_modules/@eslint/eslintrc/lib/config-array-factory.js:814:25)
at ConfigArrayFactory._normalizeObjectConfigDataBody (file:///node_modules/@eslint/eslintrc/lib/config-array-factory.js:752:25)


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/lib/components/blocks/home/Hero.tsx (2)

1-48: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Add "use client" directive to enable client-side features.

This component uses client-side only features:

  • useRouter hook from 'next/navigation' (line 2, 8)
  • Framer Motion animations with whileHover and whileTap (lines 10, 31, 36)

Without the "use client" directive, this component will fail in Next.js App Router. As per coding guidelines, ensure "use client" is used when client-side features are required.

🔧 Add "use client" directive
+"use client";
+
 import { Button } from "`@/lib/components/ui/button`";
 import { useRouter } from "next/navigation";

As per coding guidelines for NextJS: Components must include "use client" when using client-side features and ensure only features that allow pure client-side rendering are used.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/components/blocks/home/Hero.tsx` around lines 1 - 48, This component
uses client-only hooks and Framer Motion (useRouter, motion, whileHover,
whileTap) so add the "use client" directive as the very first line of the file
to enable client-side rendering; ensure it appears before any imports in the
Hero component file so useRouter and Framer Motion animations work correctly.

37-37: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use Link or anchor tag for external documentation URL.

router.push() is intended for internal client-side navigation within the Next.js app. For external URLs like documentation links, use an anchor tag with target="_blank" and rel="noopener noreferrer" for security, or configure the Next.js Link component appropriately.

🔗 Recommended fix using anchor tag
               <motion.div whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }}>
-                <Button size={"lg"} variant={"outline"} onClick={() => router.push("https://docs.stability.nexus/gluon-protocols/gluon-overview")}>
+                <Button size={"lg"} variant={"outline"} asChild>
+                  <a href="https://docs.stability.nexus/gluon-protocols/gluon-overview" target="_blank" rel="noopener noreferrer">
                   Read Docs
+                  </a>
                 </Button>
               </motion.div>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/components/blocks/home/Hero.tsx` at line 37, The Button currently
uses router.push in its onClick handler (onClick={() =>
router.push("https://docs.stability.nexus/gluon-protocols/gluon-overview")})
which is meant for internal navigation; replace this with an anchor-based
solution: render the Button as an anchor (<a> or your Button's "as" /
"component" prop if available) pointing to the external URL, add target="_blank"
and rel="noopener noreferrer", and remove the router.push usage so the Button
behaves as a proper external link.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/lib/components/blocks/home/Hero.tsx`:
- Around line 1-48: This component uses client-only hooks and Framer Motion
(useRouter, motion, whileHover, whileTap) so add the "use client" directive as
the very first line of the file to enable client-side rendering; ensure it
appears before any imports in the Hero component file so useRouter and Framer
Motion animations work correctly.
- Line 37: The Button currently uses router.push in its onClick handler
(onClick={() =>
router.push("https://docs.stability.nexus/gluon-protocols/gluon-overview")})
which is meant for internal navigation; replace this with an anchor-based
solution: render the Button as an anchor (<a> or your Button's "as" /
"component" prop if available) pointing to the external URL, add target="_blank"
and rel="noopener noreferrer", and remove the router.push usage so the Button
behaves as a proper external link.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 597ecde0-0c4b-457a-b77b-e0f74bd41c62

📥 Commits

Reviewing files that changed from the base of the PR and between 661c158 and 1c56514.

📒 Files selected for processing (1)
  • src/lib/components/blocks/home/Hero.tsx

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.

Button gets clipped when hovered

1 participant