work.ex 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. defmodule CvGenView.Work do
  2. use Phoenix.Component
  3. import CvGenView.Date, only: [date: 1]
  4. attr(:name, :string, required: true)
  5. attr(:start_date, :any, required: true)
  6. attr(:end_date, :any, default: nil)
  7. attr(:summary, :string, required: true)
  8. attr(:highlights, :list, required: true)
  9. def work(assigns) do
  10. ~H"""
  11. <div>
  12. <h1><%= @name %></h1>
  13. <dl>
  14. <dt class="position" lang="fr">Poste</dt>
  15. <dd lang="fr"><%= @position %></dd>
  16. <dt class="start_date">Date début</dt>
  17. <dd><.date class="start_date" date={@start_date} /></dd>
  18. <%= unless is_nil(@end_date) do %>
  19. <dt class="end_date">Date fin</dt>
  20. <dd><.date class="end_date" date={@end_date} /></dd>
  21. <% end %>
  22. <dt class="work_location"></dt>
  23. <dd>Paris</dd>
  24. </dl>
  25. <p class="summary" lang="en"><%= @summary %></p>
  26. <ul class="highlights">
  27. <%= for highlight <- @highlights do %>
  28. <li><%= highlight %></li>
  29. <% end %>
  30. </ul>
  31. </div>
  32. """
  33. end
  34. def css,
  35. do: """
  36. #work {
  37. }
  38. """
  39. end