work.ex 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 ul.highlights > li {
  73. border: #bbb solid 1px;
  74. margin-top: 0.3em;
  75. padding: 0.4em;
  76. font-weight: lighter;
  77. }
  78. .work ul.highlights {
  79. }
  80. #work > ol > li {
  81. margin: 2em auto;
  82. padding-left: 0.5em;
  83. }
  84. #work ul.skills {
  85. display: flex;
  86. flex-wrap: wrap;
  87. gap: 0.2em;
  88. margin-top: 1em;
  89. }
  90. #work .skills > li {
  91. padding: 3px 7px;
  92. font-size: 0.7em;
  93. font-weight: 700;
  94. color: #fff;
  95. text-align: center;
  96. background-color: #333;
  97. border-radius: 0.5em;
  98. }
  99. """
  100. end