work.ex 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. defmodule CvGenView.Work do
  2. use Phoenix.Component
  3. alias CvGenView.{Date, Text}
  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. <Date.time_span start_date={@start_date} end_date={@end_date} />
  18. </div>
  19. <h1><%= @position %></h1>
  20. <Text.text text={@summary} class="summary" />
  21. <h2>Points clés</h2>
  22. <ul class="highlights">
  23. <%= for highlight <- @highlights do %>
  24. <li><%= highlight %></li>
  25. <% end %>
  26. </ul>
  27. <ul class="skills">
  28. <%= for skill <- @skills do %>
  29. <li><%= skill %></li>
  30. <% end %>
  31. </ul>
  32. </div>
  33. """
  34. end
  35. def css,
  36. do: """
  37. .work h1 {
  38. margin: 0;
  39. }
  40. .work > * {
  41. padding-left: 0.5em;
  42. }
  43. .work > .heading {
  44. display: grid;
  45. grid-template-areas:
  46. "header location"
  47. "period _";
  48. gap: 0.5em;
  49. background-color: #eee;
  50. padding: 0.5em;
  51. margin-bottom: 1em;
  52. }
  53. .work > .heading > h1 {
  54. font-weight: bold;
  55. }
  56. .work > .heading > .location {
  57. font-weight: bold;
  58. justify-self: end;
  59. text-align: end;
  60. }
  61. .work > .heading > .period {
  62. font-weight: lighter;
  63. }
  64. .work > h1 {
  65. font-weight: bold;
  66. }
  67. .work > h2 {
  68. font-size: 0.85em;
  69. }
  70. .work > p {
  71. margin: 0.5em 0;
  72. }
  73. .work ul.highlights > li {
  74. border: #bbb solid 1px;
  75. margin-top: 0.3em;
  76. padding: 0.4em;
  77. font-weight: lighter;
  78. }
  79. .work ul.highlights {
  80. }
  81. #work > ol > li {
  82. margin: 2em auto;
  83. padding-left: 0.5em;
  84. }
  85. #work ul.skills {
  86. display: flex;
  87. flex-wrap: wrap;
  88. gap: 0.2em;
  89. margin-top: 1em;
  90. }
  91. #work .skills > li {
  92. padding: 3px 7px;
  93. font-size: 0.7em;
  94. font-weight: 700;
  95. color: #fff;
  96. text-align: center;
  97. background-color: #333;
  98. border-radius: 0.5em;
  99. }
  100. @media print {
  101. #work .skills > li {
  102. color: #000;
  103. background-color: #fff;
  104. border: #000 solid 0.2em;
  105. }
  106. }
  107. """
  108. end