work.ex 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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(:location, :string, required: true)
  9. attr(:highlights, :list, required: true)
  10. def work(assigns) do
  11. ~H"""
  12. <div class="work">
  13. <div class="heading">
  14. <h1><%= @name %></h1>
  15. <span class="location"><%= @location %></span>
  16. <div class="period">
  17. <%= @start_date %> - <%= @end_date || "aujourd'hui" %>
  18. </div>
  19. </div>
  20. <p class="summary" lang="en"><%= @summary %></p>
  21. <ul class="highlights">
  22. <%= for highlight <- @highlights do %>
  23. <li><%= highlight %></li>
  24. <% end %>
  25. </ul>
  26. </div>
  27. """
  28. end
  29. def css,
  30. do: """
  31. .work h1 {
  32. margin: 0;
  33. }
  34. .work > .heading {
  35. display: grid;
  36. grid-template-areas:
  37. "header location"
  38. "period _";
  39. row-gap: 0.5em;
  40. background-color: #eee;
  41. padding: 0.5em;
  42. }
  43. .work > .heading > h1 {
  44. font-weight: bold;
  45. }
  46. .work > .heading > .location {
  47. font-weight: bold;
  48. justify-self: end;
  49. }
  50. .work > .heading > .period {
  51. font-weight: lighter;
  52. }
  53. """
  54. end