Skip to content
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

feat: Add support for new <Drawer.SnapPoint /> #548

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

s-fletcher
Copy link

@s-fletcher s-fletcher commented Feb 12, 2025

Problem

Hard coded snapPoint values are not ideal for responsive drawers. In the video bellow, notice how the snap point is not consistently under the "Buy" button when the screen is smaller.

CleanShot.2025-02-12.at.01.19.06.mp4

Solution

Introduce a new Drawer.SnapPoint component to determine where the snaps occur based on their position in the DOM. This solution was inspired by this issue #330

Caution

Although functional, this PR is still a WIP as I find time to contribute.

Todo

  • Define <Drawer.SnapPoint />
  • Support offset prop in <Drawer.SnapPoint />
  • Add example inside test app
  • Add tests around new feature
  • Investigate how feature behaves with nested drawers
  • Add comprehensive demo to PR

Wishlist

  • Support name prop in <Drawer.SnapPoint />
    • The idea here is to allow the consumer to reference that snap point by name now that the point is dynamic.
  • Support a callback inside snapPoints prop to combine both hard coded and embedded snap points

@s-fletcher s-fletcher changed the title Add support for new <Drawer.SnapPoint /> feat: Add support for new <Drawer.SnapPoint /> Feb 12, 2025
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.

1 participant