work.ex 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. defmodule CvGenView.Work do
  2. use Phoenix.Component
  3. alias CvGenView.Date
  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. attr(:skills, :list, default: [])
  11. def work(assigns) do
  12. ~H"""
  13. <div class="work">
  14. <div class="heading">
  15. <h1><%= @name %></h1>
  16. <span class="location"><%= @location %></span>
  17. <div class="period">
  18. <Date.date date={@start_date} /> - <Date.date date={@end_date} />
  19. </div>
  20. </div>
  21. <h1><%= @position %></h1>
  22. <p class="summary" lang="en"><%= @summary %></p>
  23. <h2>Points clés</h2>
  24. <ul class="highlights">
  25. <%= for highlight <- @highlights do %>
  26. <li><%= highlight %></li>
  27. <% end %>
  28. </ul>
  29. <ul class="skills">
  30. <%= for skill <- @skills do %>
  31. <li><%= skill %></li>
  32. <% end %>
  33. </ul>
  34. </div>
  35. """
  36. end
  37. def css,
  38. do: """
  39. .work h1 {
  40. margin: 0;
  41. }
  42. .work > * {
  43. padding-left: 0.5em;
  44. }
  45. .work > .heading {
  46. display: grid;
  47. grid-template-areas:
  48. "header location"
  49. "period _";
  50. gap: 0.5em;
  51. background-color: #eee;
  52. padding: 0.5em;
  53. margin-bottom: 1em;
  54. }
  55. .work > .heading > h1 {
  56. font-weight: bold;
  57. }
  58. .work > .heading > .location {
  59. font-weight: bold;
  60. justify-self: end;
  61. text-align: end;
  62. }
  63. .work > .heading > .period {
  64. font-weight: lighter;
  65. }
  66. .work > h1 {
  67. font-weight: bold;
  68. }
  69. .work > h2 {
  70. font-size: 0.85em;
  71. }
  72. #work > ol > li {
  73. margin: 2em auto;
  74. padding-left: 0.5em;
  75. }
  76. #work ul.skills {
  77. display: flex;
  78. flex-wrap: wrap;
  79. gap: 0.2em;
  80. margin-top: 1em;
  81. }
  82. #work .skills > li {
  83. padding: 3px 7px;
  84. font-size: 0.7em;
  85. font-weight: 700;
  86. color: #fff;
  87. text-align: center;
  88. background-color: #333;
  89. border-radius: 0.5em;
  90. }
  91. """
  92. end