-
Notifications
You must be signed in to change notification settings - Fork 7
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
BottomSheet component #9
BottomSheet component #9
Conversation
Reviewer's Guide by SourceryThis pull request introduces a BottomSheet component using Zustand for state management and Radix UI for dialog and presence. It also includes configuration for different bottom sheet contents. Sequence diagram for BottomSheet interaction flowsequenceDiagram
actor User
participant TB as TradeButton
participant BS as BottomSheet
participant BSS as BottomSheetStore
User->>TB: Clicks Rise button
TB->>BSS: setBottomSheet(true, 'rise-contract')
BSS->>BS: Updates state
BS->>BS: Renders overlay and sheet
Note over BS: User can dismiss by:
alt Swipe down
User->>BS: Swipes down
BS->>BS: Tracks touch movement
BS->>BSS: setBottomSheet(false)
else Tap overlay
User->>BS: Taps overlay
BS->>BSS: setBottomSheet(false)
end
Class diagram for BottomSheet component structureclassDiagram
class BottomSheet {
+useRef() sheetRef
+useRef() dragStartY
+useRef() currentY
+useRef() isDragging
+handleTouchStart()
+handleTouchMove()
+handleTouchEnd()
+render()
}
class BottomSheetStore {
+boolean showBottomSheet
+string|null key
+string height
+setBottomSheet(show, key?, height?)
}
class BottomSheetConfig {
+ReactNode body
}
BottomSheet ..> BottomSheetStore : uses
BottomSheet ..> BottomSheetConfig : uses
State diagram for BottomSheet componentstateDiagram-v2
[*] --> Hidden
Hidden --> Visible: setBottomSheet(true)
state Visible {
[*] --> Idle
Idle --> Dragging: Touch Start
Dragging --> Idle: Touch End (deltaY < 100)
Dragging --> Hidden: Touch End (deltaY > 100)
}
Visible --> Hidden: setBottomSheet(false)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @ahmadtaimoor-deriv - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider extracting the touch gesture logic into a custom hook (e.g.
useBottomSheetGestures
) to improve reusability and testability - The touch gesture handling could be more robust by handling edge cases like interrupted animations and rapid successive gestures
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@ahmadtaimoor-deriv let's generate/update docs for these changes |
Summary by Sourcery
Introduce the BottomSheet component for displaying trade contracts.
New Features:
Tests: