Closed angelikatyborska closed 2 months ago
The incompatible code is this and only this:
I was very much mistaken. There's more incompatible code. In fact, the whole approach to writing forms changed. A quick summary:
Removed in phoenix_html 4 (https://hexdocs.pm/phoenix_html/changelog.html#v4-0-0-2023-12-19)
Phoenix.HTML.Tag.content_tag
Phoenix.HTML.Form.input
Phoenix.HTML.Form.label
Phoenix.HTML.Form.select
Phoenix.HTML.Form.textarea
Phoenix.HTML.Form.humanize
and probably more...New "phoenix way" of creating forms:
In a newely generated Phoenix app, there's a module CoreComponents
that includes components like input
, label
, error
.
New "phoenix way" of writing HTML when tags are dynamic (replacement for Phoenix.HTML.Tag.content_tag
):
No idea ???
Fallback for people who do not want to use the new "phoenix way": Old HTML helpers were moved to a separate library: https://hexdocs.pm/phoenix_html_helpers/PhoenixHTMLHelpers.html
True. But that part can be replaced also by writing our own html templates, just like we do with the other components.
I think the main think will be BitstylesPhoenix.Component.Form.render_input/4
needs to be componentized. But luckily the interface is well defined.
New "phoenix way" of writing HTML when tags are dynamic (replacement for Phoenix.HTML.Tag.content_tag):
No idea ???
The only place that I know is the heading component. And there we might want to deprecate the tag
attribute in favour of level
and just have a dynamic assign for <h1>
to <h6>
.
I think we should move towards the new way of things there.
So the desired way forward would be roughly to:
phoenix_html_helpers
?
Elixir Slack to the rescue, the correct replacement for Phoenix.HTML.tag.content_tag
would be https://hexdocs.pm/phoenix_live_view/Phoenix.Component.html#dynamic_tag/1
Currently, this library is not compatible with phoenix_html v4. The incompatible code is this and only this:
Phoenix.HTML.Tag
no longer exists in phoenix_html, it was extracted to a separate library,phoenix_html_helpers
, and renamed (PhoenixHTMLHelpers.Tag
)Note that it's a bit weird that this library uses phoenix_html directly but does not list it in its
mix.exs
.