petalframework / petal_components

Phoenix + Live View HEEX Components
https://petal.build/components
MIT License
768 stars 84 forks source link

Add support for disabled attribute on dropdown menu items #249

Closed RobinBoers closed 10 months ago

RobinBoers commented 10 months ago

Hi! I added support for the disabled attribute on the dropdown_menu_item component.

I don't know whether this is the correct way to apply styling. I tried to mirror the approach that the button component uses.

Also, sorry for the giant diff! I removed the annoying brackets the formatter adds everywhere. Btw, that has been fixed a while ago in ElixirLS, see elixir-lsp/elixir-ls#526.

mplatts commented 10 months ago

Thanks - looks good. Yeah we used string interpolation elsewhere in the project, although now I think the best way is to use a list.. eg "#{@class} pc-dropdown__menu-item #{get_disabled_classes(@disabled)}" => [@class, "pc-dropdown__menu-item", get_disabled_classes(@disabled).

Is it possible to add a test in dropdown_test.exs?

RobinBoers commented 10 months ago

On it!

RobinBoers commented 10 months ago

So the Link.a component that's used under-the-hood expected a :string in the attrs, so I changed that to :any, since I don't think the syntax supports union types.

mplatts commented 10 months ago

🙏

nhobes commented 10 months ago

Released in 1.4.6. Thanks for this!