phoenixframework / phoenix

Peace of mind from prototype to production
https://www.phoenixframework.org
MIT License
21.46k stars 2.88k forks source link

Add a link with custom classes in CoreComponents wrapping the built-in link component #5909

Open francois08 opened 3 months ago

francois08 commented 3 months ago

In generated CoreComponents we are provided a set of components encapsulating their TW classes (which avoids us repeating these classes application-wide).

I think we should add a <.link> component wrapping the built-in link component which allows the developer to customize the styling of the links.

This would be more consistent where other basic components such as button, label, etc. have their styling encapsulated (while for <.link>, by default in a generated application, we have to copy the TW classes application-wide).

Therefore it would be more logical and consistent to have a link component in CoreComponents alongside the other basic components.

SteffenDE commented 3 months ago

Related: https://github.com/phoenixframework/phoenix/pull/5820

The main issue I see with wrapping the link component is that we’d need to mirror the API of Phoenix.Component.link/1 and there’s currently no nice way to do this. I didn’t test this but there would probably also be a conflict when useing Phoenix.Component.