-
Notifications
You must be signed in to change notification settings - Fork 43
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
How to reuse elm view/logic on different projects? #125
Comments
Hi @SimonLab, maybe this a repo could you help. Now we've almost finished it but we have to write a tons of descriptions for that (and maybe a few refactoring of code, mainly an animation part) before than we insert it on elm-package web. We've created a component (in our case it's modal window) which could be reused with different UI and different behaviours. I think that would be good point for your reading too. |
Thanks for the link to your repository @ondrej-tucek , I'll definitely have a look at it and try to give you some feedback 👍 |
Okay, that would be great, thanks. |
I've done more research and reading (especially https://github.com/evancz/elm-sortable-table) to try to understand how to make the code reusable. I think the main two concepts to remember is
I'll try to explain in more details about these two points on my PR (#126) |
On the following project: https://github.com/club-soda/club-soda-guide, one of the feature is to allow user to filter a list of drinks based on types (first level filters) and styles (sub level fitlers):
As the UI and logic of this type of feature is not obvious/easy to implement with vanilla js it makes sense to use elm and with the idea of being able to reuse this kind of filtering on other projects (see dwyl/technology-stack#67) I looked at how to make the elm code reusable.
I'm still not sure what is the best way to do this. Some projects will have different requirements (for example different UI, different logic of filtering...) and it's quiet tricky to make the elm code abstract enough to be reused on different type of projects. I think trying to create some code that can be used and configured anywhere would be the perfect solution but I don't think it is the right way to start as it makes things overcomplicated for a first version.
So my goal is first to create an understanding step by step guide on how to create the above type of "dropdown filter" with Elm. Then during the writing of this guide some questions and solutions will come in mind and a better (more reusable) version of this Elm module will be created.
Some reading:
some watching:
some tweets:
The text was updated successfully, but these errors were encountered: