work.ex 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. 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. <Date.date date={@start_date} /> - <Date.date date={@end_date} />
  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. 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. text-align: end;
  55. }
  56. .work > .heading > .period {
  57. font-weight: lighter;
  58. }
  59. .work > h1 {
  60. font-weight: bold;
  61. }
  62. #work > ol > li {
  63. margin: 2em auto;
  64. padding-left: 0.5em;
  65. }
  66. """
  67. end