Bladeren bron

Prepare education component

theenglishway (time) 2 jaren geleden
bovenliggende
commit
1e67b638a6
2 gewijzigde bestanden met toevoegingen van 21 en 11 verwijderingen
  1. 2 1
      lib/templates/cv.html.heex
  2. 19 10
      lib/views/education.ex

+ 2 - 1
lib/templates/cv.html.heex

@@ -36,6 +36,7 @@
       <%= Work.css() |> Phoenix.HTML.raw() %>
       <%= Basics.css() |> Phoenix.HTML.raw() %>
       <%= Skill.css() |> Phoenix.HTML.raw() %>
+      <%= Education.css() |> Phoenix.HTML.raw() %>
 
       dt.work_location+dd::before {
         content: '🏢 ' attr(value);
@@ -78,7 +79,7 @@
 
       <ol>
         <%= for educ <- @education do %>
-          <li><Education.education educ={educ} /></li>
+          <li><Education.education {educ} /></li>
         <% end %>
       </ol>
     </div>

+ 19 - 10
lib/views/education.ex

@@ -2,20 +2,29 @@ defmodule CvGenView.Education do
   use Phoenix.Component
   import CvGenView.Date, only: [date: 1]
 
-  attr(:educ, :map)
+  attr(:institution, :string, required: true)
+  attr(:location, :string, required: true)
+  attr(:start_date, :string, required: true)
+  attr(:end_date, :string, required: true)
 
   def education(assigns) do
     ~H"""
-    <h1><%= @educ.institution %></h1>
+    <div class="education">
+      <h1><%= @institution %></h1>
 
-    <dl>
-      <dt class="location"></dt>
-      <dd><%= @educ[:location] %></dd>
-      <dt class="start_date">Date début</dt>
-      <dd><.date class="start_date" date={@educ.start_date} /></dd>
-      <dt class="end_date">Date fin</dt>
-      <dd><.date class="end_date" date={@educ.end_date} /></dd>
-    </dl>
+      <dl>
+        <dt class="location"></dt>
+        <dd><%= @location %></dd>
+        <dt class="start_date">Date début</dt>
+        <dd><.date class="start_date" date={@start_date} /></dd>
+        <dt class="end_date">Date fin</dt>
+        <dd><.date class="end_date" date={@end_date} /></dd>
+      </dl>
+    </div>
     """
   end
+
+  def css(),
+    do: """
+    """
 end