-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add gem configuration, with base component customization #160
Add gem configuration, with base component customization #160
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a stab at this!
lib/view_component/form.rb
Outdated
@@ -1,10 +1,20 @@ | |||
# frozen_string_literal: true | |||
|
|||
require "view_component" | |||
require_relative "form/configuration" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this line? Can Zeitwerk autoload the constant without it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the test suite without it in d1e420c and it seems to be loaded just fine!
I'll do another test in my production Rails application.
Co-authored-by: Hans Lemuet <[email protected]>
@joelzwarrington mind adding a note to the CHANGELOG? |
Yep, I'll add a note to the change log 😄 |
What
ViewComponent::Form
parent_component
which allViewComponent::Form
components inherit from, and defaults toViewComponent::Base
Why
So that one can define shared logic without having to use concerns or building their own components that don't inherit from their
ViewComponent::Form
component counterpart.As an example, let's say I'd like to use the heroicon gem to add icons to my fields, I can do that easily by defining my own
ApplicationFormComponent
or, if I'm using Tailwind, I could use tailwind_merge to merge HTML classes to avoid conflicts, etc.