text.ex 417 B

12345678910111213141516171819
  1. defmodule CvGenView.Text do
  2. use Phoenix.Component
  3. use CvGen.RegenerateOnCompilation
  4. attr(:text, :any, required: true)
  5. attr(:rest, :global)
  6. def text(assigns) when is_binary(assigns.text),
  7. do: ~H"""
  8. <p {@rest}><%= @text %></p>
  9. """
  10. def text(assigns) when is_list(assigns.text),
  11. do: ~H"""
  12. <%= for paragraph <- @text do %>
  13. <p {@rest}><%= paragraph %></p>
  14. <% end %>
  15. """
  16. end