onlook-dev / onlook

The open source, local-first Figma for React. Design directly in your live React app and publish your changes to code.
https://onlook.dev
Apache License 2.0
3.75k stars 233 forks source link

[feat] When a new element is drawn in a stack or grid, insert it to the closest reasonable index #662

Closed drfarrell closed 3 weeks ago

drfarrell commented 4 weeks ago

Currently new elements append to the end of the stack or grid, but it would be expected that the element is dropped-in within the stack or grid at the index closest to where it was drawn.

Kitenite commented 3 weeks ago

This should be somewhat straightforward using existing helpers from drag elements and change get insert location to return an index instead of an append https://github.com/onlook-dev/onlook/blob/615ea6c92ec55765ca4767ad5e194395750d3873/app/electron/preload/webview/elements/dom/insert.ts#L9-L21

sambhavnrana commented 3 weeks ago

Would like to work on it @drfarrell :)

Kitenite commented 3 weeks ago

Go for it @sambhavnrana