jensljungblad / elemental_components

Simple view components for Rails 5.1+
MIT License
76 stars 5 forks source link

Open to Pull Requests? #36

Open topherfangio opened 5 years ago

topherfangio commented 5 years ago

Hi there!

My company is looking at potentially using components for a large project and we were wondering if you would be open to Pull Requests from us and if you had the time to maintain the project.

If so, then we'll start sending them your way as soon as we find things we'd like to add/change.

If not, would you be willing to add some of our developers as maintainers? Or would you prefer if we just did a fork?

We're still debating what framework we will use, but I wanted to start the conversation now so we have some knowledge ahead of time.

Thanks so much!

jensljungblad commented 5 years ago

Hey there! Yeah I'm open to PRs, or discussions around changes. There's also the new https://github.com/github/actionview-component which you might be interested in, as it is headed for Rails master, I believe. I've been thinking about looking into building on top of that. I think what this gem brings to the table is basically the DSL that helps you structure components into attributes and elements. If that is what you find interesting about this gem as well, I'd be happy to listen to your thoughts/feedback!

Also open to adding someone as maintainer, if we agree on the direction of the library.

topherfangio commented 5 years ago

Hey man! So sorry I missed this!

Yeah, I think a DSL on top of AV:C would be amazing! Just curious, what do you think it would take to switch to AV:C as the base for components? Have you done any investigative work in this regard? I'm happy to jump in and help out any way I can!

topherfangio commented 5 years ago

Also, do you see any other parts of a DSL that would be valuable? Honestly, the attributes and elements is a massive value add; but I'd love to hear any other thoughts you have!

jensljungblad commented 5 years ago

@topherfangio I just looked at it briefly yesterday for the first time :) Couldn't figure out how to access the instantiated component from the template though, which would be kind of a problem. If you want to investigate further, that'd be great!

When I built this, I was mostly interested in the attributes/elements part of it. I was always kind of annoyed in React that there wasn't a better solution for "internal" parts of a component, or the "elements" in BEM. I did not spend a lot of time optimizing for rendering speed, partial lookup etc, which is one reason it would be nice if it could build on top of AV:C, since they're probably going to deal with all of that.

topherfangio commented 5 years ago

@jensljungblad I just threw a self.inspect in the template and it seemed to work for me 😄

But perhaps a better way is to override the initialize method to do something like @component = self (or maybe @vm = self) just to be more semantic?

topherfangio commented 4 years ago

Just for posterity in case anyone outside of our circle is looking at this thread; I am working on a potential solution which I am tracking on the AV:C repo: https://github.com/github/actionview-component/issues/15#issuecomment-532702473

topherfangio commented 4 years ago

@jensljungblad I have a version of this working now with ActionView Component and we are beginning to use it!

Just wanted to touch base and see if/how we can contribute our changes back to the community. Are you wanting to update this repo and perhaps rename it so we can release it as a gem on top of AV:C?

In my own code, I have tentatively named it BetterComponent and it is a single file which extends from ActionView::Component and provides the necessary additions/changes.

Additionally, I would love to make a small PR to AV:C to change their render_in function to be a bit more extensible, but we can in fact just override it as I showed in my gist.

Thanks for your thoughts!

jensljungblad commented 4 years ago

Sounds promising! I have very limited time, but perhaps it's a good idea for you to test it out in your project first?

Pretty cool that you were able to built on top of AV:C without running into any blockers. Sending some PRs their way making it even more flexible sounds good too!