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

What about making the item count adaptable to the screen width? #2

Open
mathieueveillard opened this issue Apr 17, 2019 · 4 comments
Open
Labels
feature New feature or request wontfix This will not be worked on

Comments

@mathieueveillard
Copy link
Owner

mathieueveillard commented Apr 17, 2019

atlassian/react-beautiful-dnd#316 (comment)

@mathieueveillard
Copy link
Owner Author

Hi @cilvet,

I believe this would require to write another HOC that computes the maxItems props and provides it to its child component. Computing maxItems requires information of a single item width (can be provided as prop) as well as the width of the parent container (react-container-dimensions could help). Though, not sure this is so react-ish.

What would be the case leading to this requirement?

Thanks

@davidchappy
Copy link

davidchappy commented Apr 25, 2019

Here's our use case, a responsive grid of fixed-size cards. We'd love to use this library if width auto-detection worked.

flashcards

Edit:
As a point of reference, react-sortable-hoc works great, except that it suffers from the mobile dragging issue.

@mathieueveillard
Copy link
Owner Author

Hi @davidchappy, and thank you for the follow-up and the elements of context.

Definitely, an HOC looks like an appropriate solution. You could use maxItems as key of the wrapped component in order to recreate it each time maxItems updates.

Now I wonder if it should be part of react-beautiful-dnd-grid: I certainly understand your need, but to me, it looks like a separate topic than drag and drop. Proof is the solution I suggest, based on a HOC. Furthermore, some other applications could have different expectations, like shrinking the items width while maintaining the same number of items per row. This could lead to over-generic solutions.

@mathieueveillard mathieueveillard added feature New feature or request wontfix This will not be worked on labels Apr 25, 2019
@davidchappy
Copy link

davidchappy commented Apr 26, 2019

Thanks @mathieueveillard. I think that makes a lot of sense technically, but from a practical use perspective it seems that many would need this to be mobile responsive. Perhaps a responsive or fixedWidth flag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants