Skip to content

Conversation

@jimwei1
Copy link
Contributor

@jimwei1 jimwei1 commented Jan 13, 2026

Description

Create ResponsiveComponent to handle different page variants (Desktop / Mobile / etc.)

How has this been tested?

Test component

Mobile:

image

Desktop:

image

Tickets

closes LAY-2126


Note

Introduces a reusable responsive wrapper and streamlines element sizing across components.

  • Add ui/ResponsiveComponent with slots and resolveVariant to render Desktop/Mobile variants based on container width; includes basic styles
  • Refactor useElementSize to accept a single size object ({ width, height }), trigger initial measurement on mount, and use ResizeObserver border-box sizes with light debounce
  • Update BankTransactions and Tabs to the new useElementSize signature and adjust width/height handling accordingly

Written by Cursor Bugbot for commit 3335877. This will update automatically on new commits. Configure here.

Context used:

  • Rule from dashboard - In Typescript files, use type declarations instead of interface declarations if the object is in... (source)

@jimwei1 jimwei1 requested a review from sarahraines January 13, 2026 18:43
@jimwei1 jimwei1 changed the title Zjw/responsive component Create ResponsiveComponent Component Jan 13, 2026
@jimwei1 jimwei1 changed the title Create ResponsiveComponent Component Create ResponsiveComponent Block Jan 13, 2026
@augmentcode
Copy link

augmentcode bot commented Jan 13, 2026

🤖 Augment PR Summary

Summary: Adds a reusable ResponsiveComponent that selects and renders a variant (Desktop/SmallDesktop/Mobile or custom) based on its container width.

Changes:

  • Introduced a generic ResponsiveComponent with slots + resolveVariant API.
  • Uses useElementSize (ResizeObserver) to track container width and update the active variant.
  • Added scoped styles so the wrapper fills its parent (height/width 100%).

Technical Notes: Variant updates are driven by resize observation of the component’s own wrapper element (not window size), enabling responsive behavior inside nested layouts.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

jimwei1 and others added 2 commits January 13, 2026 11:22
Co-authored-by: Sarah Raines <32247313+sarahraines@users.noreply.github.com>
Co-authored-by: Sarah Raines <32247313+sarahraines@users.noreply.github.com>
@jimwei1 jimwei1 merged commit 874d5e2 into main Jan 13, 2026
7 checks passed
@jimwei1 jimwei1 deleted the zjw/responsive-component branch January 13, 2026 22:38
setCurrentWidth(c.width)
const elementRef = useElementSize<HTMLDivElement>((size) => {
if (size.width !== currentWidth) {
setCurrentWidth(size.width)
Copy link

Choose a reason for hiding this comment

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

Removed truthy check allows zero width update

Low Severity

The condition was changed from c.width && c?.width !== currentWidth to size.width !== currentWidth, removing the truthy check on width. Previously, when the element's width became 0 (e.g., when hidden), currentWidth would retain its last non-zero value. Now it will update to 0, which triggers updateSelectPosition via the useEffect dependency on currentWidth. This could cause incorrect thumb positioning calculations when the tabs component is temporarily hidden and then shown again.

Fix in Cursor Fix in Web

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.

3 participants