[01694] Extract useScrollShadow hook from HeaderLayout and DataTable#3024
Merged
nielsbosma merged 1 commit intomainfrom Apr 4, 2026
Merged
[01694] Extract useScrollShadow hook from HeaderLayout and DataTable#3024nielsbosma merged 1 commit intomainfrom
nielsbosma merged 1 commit intomainfrom
Conversation
Create reusable useScrollShadow() hook that tracks scroll position to trigger shadow effects. Refactor HeaderLayoutWidget to use the hook instead of inline useState/useRef/useEffect pattern.
Collaborator
Deploy timed outI'm preparing your docs & samples for this PR. I'll update the comment as Sliplane reports progress. Logs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Extracted the scroll-triggered shadow pattern from
HeaderLayoutWidgetinto a reusableuseScrollShadow()hook. The hook encapsulatesuseState,useRef, anduseEffectfor tracking scroll position on Radix ScrollArea viewports. HeaderLayoutWidget was refactored to use the hook, replacing 14 lines of inline logic with a single hook call.DataTable was investigated but does not currently use this scroll shadow pattern, so no changes were needed there.
API Changes
useScrollShadow(selector?)hook exported from@/hooks/use-scroll-shadowselectorparameter (default:"[data-radix-scroll-area-viewport]") — CSS selector for the scroll container{ isScrolled: boolean, scrollRef: React.RefObject<HTMLDivElement> }Files Modified
src/frontend/src/hooks/use-scroll-shadow.tssrc/frontend/src/hooks/use-scroll-shadow.test.ts(12 tests)src/frontend/src/widgets/layouts/HeaderLayoutWidget.tsx— replaced inline scroll logic withuseScrollShadow()hookCommits