work.ex 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. <h1><%= @position %></h1>
  21. <p class="summary" lang="en"><%= @summary %></p>
  22. <ul class="highlights">
  23. <%= for highlight <- @highlights do %>
  24. <li><%= highlight %></li>
  25. <% end %>
  26. </ul>
  27. </div>
  28. """
  29. end
  30. def css,
  31. do: """
  32. .work h1 {
  33. margin: 0;
  34. }
  35. .work > * {
  36. padding-left: 0.5em;
  37. }
  38. .work > .heading {
  39. display: grid;
  40. grid-template-areas:
  41. "header location"
  42. "period _";
  43. row-gap: 0.5em;
  44. background-color: #eee;
  45. padding: 0.5em;
  46. margin-bottom: 1em;
  47. }
  48. .work > .heading > h1 {
  49. font-weight: bold;
  50. }
  51. .work > .heading > .location {
  52. font-weight: bold;
  53. justify-self: end;
  54. }
  55. .work > .heading > .period {
  56. font-weight: lighter;
  57. }
  58. .work > h1 {
  59. font-weight: bold;
  60. }
  61. #work > ol > li {
  62. margin: 2em auto;
  63. padding-left: 0.5em;
  64. }
  65. """
  66. end