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: snap points with <Drawer.SnapPoint /> #330

Open
mehdibha opened this issue Apr 23, 2024 · 3 comments
Open

Feat: snap points with <Drawer.SnapPoint /> #330

mehdibha opened this issue Apr 23, 2024 · 3 comments

Comments

@mehdibha
Copy link

First of all, thank you Emil for your amazing work.

I tried the snap points feature and it wasn't a good solution for me as the expected snap points weren't the same when i tried Firefox, also there's no way to handle the responsive part as the snap points would not be the same (or it will be a small headache with useMediaQuery)

Ideally, a perfect solution for me would be like this

<Drawer.Root>
  <Drawer.Trigger>Open</Drawer.Trigger>
    <Drawer.Portal>
      <Drawer.Content>
        {/** some content **/}
        <Drawer.SnapPoint />
        {/** some content **/}
        <Drawer.SnapPoint />
        {/** some content **/}
        <Drawer.SnapPoint />
      </Drawer.Content>
      <Drawer.Overlay />
    </Drawer.Portal>
</Drawer.Root>

If you are okey, i would like to work on this 😊
Any thoughts?

@artemis-prime
Copy link
Contributor

Please be clearer and more specific in terms of what your proposal is. As it is, i for one have no idea.

@mehdibha
Copy link
Author

mehdibha commented Apr 25, 2024

The idea was to make a discussion on how to implement it 😊.
i was thinking about something like this

const SnapPoint = () => {
  const { parentRef, setSnapPoints } = useContext(drawerContext)
  const ref = useRef(null)
  useEffect(()=>{
    // calculate the offset and set it
  },[])
  
  return <div ref={ref} />
}

@rortan134
Copy link
Contributor

rortan134 commented May 5, 2024

I like this. Snap points based on content height instead of hard-coded values

image

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

No branches or pull requests

3 participants