Skip to content
This repository has been archived by the owner on Feb 17, 2025. It is now read-only.

Commit

Permalink
feat: auto scroll to top of sidesheet
Browse files Browse the repository at this point in the history
  • Loading branch information
arian-garshi committed Aug 17, 2023
1 parent 1167baf commit 2f5e037
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Components/SideSheet/Comments/CommentSideSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const CommentSideSheet: FC<Props> = ({

useEffect(() => {
scrollToBottom()
}, [currentProperty])
}, [currentProperty, reviewComments])

const dummyConversations = [
// Dummy data for the "All" tab
Expand Down
12 changes: 10 additions & 2 deletions src/Components/SideSheet/SheetContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,17 @@ const SheetContainer: React.FC<Props> = ({
}
}

const scrollToTop = () => {
if (scrollableRef.current) {
scrollableRef.current.scrollTop = 0
}
}

useEffect(() => {
scrollToBottom()
}, [reviewComments])
if (activeSheetTab !== 4) {
scrollToTop()
}
}, [activeSheetTab])

if (!isOpen) return null

Expand Down

0 comments on commit 2f5e037

Please sign in to comment.