Closed mdkq closed 6 years ago
I like using https://github.com/JedWatson/classnames to map state to class attribute lists. Pass app level state down from the view to components and sub-view functions and track localized state in components. Avoid over - componentizing where its not beneficial.
Here is a simple stateless button: https://github.com/hypermodules/hyperamp/blob/master/renderer/player/elements/button/button-group.js
Example usage: https://github.com/hypermodules/hyperamp/blob/master/renderer/player/elements/player/controls.js#L56-L77
Sorry that is the button group example. I meant to share:
https://github.com/hypermodules/hyperamp/blob/master/renderer/player/elements/button/index.js
used here:
https://github.com/hypermodules/hyperamp/blob/master/renderer/player/elements/button/index.js
Thanks a lot that should be enough to get me going again. Thanks!
Hey so I'm really enjoying choo, but I'm a bit lost at the moment. I want to do a simple hamburger menu on mobile, but I'm not sure what exactly should be triggering what when I click the thing.
I'm using nanocomponent, and my current view tree is something like: main > nav > hamburger
Other than a call to hamburger.render(), nav just has a hidden list of links. Hamburger is just a hamburger button.
on hamburger click i'd like to animate the hamburger and show the nav overlay. I was going to do it by appending css classes but I can't seem to figure out how to organize it/where to append them. An onclick function in the hamburger component seems viable but then I'd have to pass the entire nav component into hamburger to append the right class to that
This seems like it has to be a common/simple problem that more experienced people would know how to do. I've already read the handbook, but is there something in there that could help me that I'm missing? Does anybody have an example from a larger project they could point me to? Thanks a ton.