Skip to content
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

Element initialization via components attributes Hash is not working #53

Open
msalzburg opened this issue Aug 9, 2023 · 1 comment · May be fixed by #54
Open

Element initialization via components attributes Hash is not working #53

msalzburg opened this issue Aug 9, 2023 · 1 comment · May be fixed by #54

Comments

@msalzburg
Copy link
Contributor

msalzburg commented Aug 9, 2023

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
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant