aviflombaum / shadcn-rails

https://shadcn.rails-components.com
MIT License
573 stars 35 forks source link

`render_` vs `ui_` vs `[component]` for main component render API #2

Closed aviflombaum closed 1 year ago

aviflombaum commented 1 year ago

I'm looking for feedback for the main component helper method naming convention. Right now it's render_[component] as in, render_dialog. I liked that because it is the method that triggers the actual rendering of the component partial while other helper methods are basically creating portals within the component partial generally via content_for.

render_dialog do 
  dialog_header "A header"
  dialog_content "Content for dialog"
end

This felt very natural to me, communicating you want to render a dialog and here are parts of the dialog.

However, in creating the input component, I think render_input is verbose. However, we can't also use input as the potential for conflict there is too high. So an option is ui_input, ui_dialog. But that feels random.

My current thinking is render_input is actually fine. Anyway, good chance I want to wrap the form stuff into a FormBuilder so they work better with form_for, etc

aviflombaum commented 1 year ago

I've come pretty far in the API and render still feels good to me.