jensljungblad / elemental_components

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

Element initialization via components attributes Hash is not working #53

Open msalzburg opened 1 year ago

msalzburg commented 1 year ago

The README describes that elements can also be initialized via the components attributes Hash. Seems like this feature is not working properly (or missing?).

see README

Another good use case is a navigation component:

# app/components/navigation_component.rb %>

class NavigationComponent < ElementalComponents::Component
  element :items, multiple: true do
    attribute :label
    attribute :url
    attribute :active, default: false
  end
end
An alternative here is to pass a data structure to the component as an attribute, if no HTML needs to be injected when rendering the component:

<%= component "navigation", items: items %>

I already prepared a PR to make it work - or am I overseening sth. here?

msalzburg commented 8 months ago

Hey @jensljungblad - any chance you could review/merge the PR soon?