Parcourir la source

Allow multi line text for summary

theenglishway (time) il y a 2 ans
Parent
commit
06e257541c
1 fichiers modifiés avec 8 ajouts et 1 suppressions
  1. 8 1
      lib/views/text.ex

+ 8 - 1
lib/views/text.ex

@@ -4,8 +4,15 @@ defmodule CvGenView.Text do
   attr(:text, :any, required: true)
   attr(:rest, :global)
 
-  def text(assigns),
+  def text(assigns) when is_binary(assigns.text),
     do: ~H"""
     <p {@rest}><%= @text %></p>
     """
+
+  def text(assigns) when is_list(assigns.text),
+    do: ~H"""
+    <%= for paragraph <- @text do %>
+      <p {@rest}><%= paragraph %></p>
+    <% end %>
+    """
 end