-
Notifications
You must be signed in to change notification settings - Fork 3
Create ResponsiveComponent Block
#1106
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
Conversation
ResponsiveComponent Component
ResponsiveComponent ComponentResponsiveComponent Block
🤖 Augment PR SummarySummary: Adds a reusable Changes:
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 👎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Sarah Raines <32247313+sarahraines@users.noreply.github.com>
Co-authored-by: Sarah Raines <32247313+sarahraines@users.noreply.github.com>
| setCurrentWidth(c.width) | ||
| const elementRef = useElementSize<HTMLDivElement>((size) => { | ||
| if (size.width !== currentWidth) { | ||
| setCurrentWidth(size.width) |
There was a problem hiding this comment.
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.
Description
Create
ResponsiveComponentto handle different page variants (Desktop / Mobile / etc.)How has this been tested?
Test component
Mobile:
Desktop:
Tickets
closes LAY-2126
Note
Introduces a reusable responsive wrapper and streamlines element sizing across components.
ui/ResponsiveComponentwithslotsandresolveVariantto render Desktop/Mobile variants based on container width; includes basic stylesuseElementSizeto accept a singlesizeobject ({ width, height }), trigger initial measurement on mount, and useResizeObserverborder-box sizes with light debounceBankTransactionsandTabsto the newuseElementSizesignature and adjust width/height handling accordinglyWritten by Cursor Bugbot for commit 3335877. This will update automatically on new commits. Configure here.
Context used:
dashboard- In Typescript files, usetypedeclarations instead ofinterfacedeclarations if the object is in... (source)