Skip to content

Commit 682ddd8

Browse files
committed
Updated the width calculation for the 'BlurTransitionText' component to prevent headline overflow on smaller screens.
1. 'demo/src/components/elements/blur-transition-text.tsx' (Updated): Adjusted 'containerWidth' logic to improve layout responsiveness - Used 'min()' function to pick the smaller of the fixed width or viewport-based width - Prevented headline overflow on mobile devices while maintaining layout stability - Added a note regarding ongoing troubleshooting of the 'containerWidth' for the headline on the home page hero
1 parent 14a6d61 commit 682ddd8

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

demo/src/components/elements/blur-transition-text.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,12 @@ export function BlurTransitionText({ phrases, className }: BlurTransitionTextPro
7676

7777
// Single wrapper span with relative positioning to contain the absolute measurement span.
7878
// This prevents the hidden span from escaping and interfering with parent layout (e.g. text-balance).
79-
// Uses width for stability on desktop (prevents jumping) + maxWidth 100% to prevent mobile overflow.
79+
// Uses min() to pick smaller of: fixed width (prevents jumping) OR viewport minus padding (prevents overflow).
8080
return (
8181
<span
8282
className="relative inline-block align-baseline"
8383
style={{
84-
width: containerWidth ? `${containerWidth}px` : 'auto',
85-
maxWidth: '100%'
84+
width: containerWidth ? `min(${containerWidth}px, 100vw - 3rem)` : 'auto'
8685
}}
8786
>
8887
{/* Hidden element used to measure phrase widths - absolutely positioned within relative parent */}

0 commit comments

Comments
 (0)