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

react demo with more use case and readme #2898

Merged
merged 1 commit into from
Dec 28, 2024
Merged

Conversation

Aysnine
Copy link
Contributor

@Aysnine Aysnine commented Dec 11, 2024

Description

A React wrapper component for GridStack that provides better TypeScript support and React integration experience.

Checklist

  • Created tests which fail without the change (if possible)
  • All tests passing (yarn test)
  • Extended the README / documentation, if necessary

@adumesny adumesny merged commit 3623892 into gridstack:master Dec 28, 2024
@adumesny
Copy link
Member

thank you for the update!

id: "item1",
h: 2,
w: 2,
content: JSON.stringify({
Copy link
Member

@adumesny adumesny Dec 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a good reason to have a json structure here instead of just
content: 'Item 1'
I suppose you can make it other thing than name:'text' (should be type) but real apps are likely to use actual components looked up by unique id or something (see angular wrapper 'selector' field) and not content field. see Angular demo with component readme.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I didn't think of doing that at the time. Since initially I wanted to store react component information on the same set of data structures, I'll try to do it your way, and may need to maintain an additional copy of the mapping relationship.

Copy link
Member

@adumesny adumesny Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, and also try to use the same class names and fields as I have done for Angular wrapper if possible ('selector' is an angular thing since that is the field we use, so pick the native React equivalent).

Maybe @damien-schneider and @GowthamTG can also chime on this so maybe between the 3 of you we can get an official React wrapper as well. I appreciate the help as I don't know React.
Also demo should be more like two.html (maybe still with nested grid) so we make sure dragging between grids also works. The key is to let Gridstack handle the grid/container creation/reparenting/layout and have React get called back when content (or in the Angular case the grid and gridItem as parents also have to be Angular based) needs to be created using native platform way.

https://github.com/gridstack/gridstack.js/tree/master/angular#more-complete-example

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.

2 participants