education.ex 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. defmodule CvGenView.Education do
  2. use Phoenix.Component
  3. alias CvGenView.Date
  4. attr(:institution, :string, required: true)
  5. attr(:location, :string, required: true)
  6. attr(:start_date, :string, required: true)
  7. attr(:end_date, :string, required: true)
  8. def education(assigns) do
  9. ~H"""
  10. <div class="education">
  11. <div class="heading">
  12. <h1><%= @institution %></h1>
  13. <span class="location"><%= @location %></span>
  14. <div class="period">
  15. <Date.date date={@start_date} /> - <Date.date date={@end_date} />
  16. </div>
  17. </div>
  18. </div>
  19. """
  20. end
  21. # TODO: Almost the same as in Work heading, but not quite.
  22. def css(),
  23. do: """
  24. .education h1 {
  25. margin: 0;
  26. }
  27. .education > .heading {
  28. display: grid;
  29. grid-template-areas:
  30. "header location"
  31. "period _";
  32. gap: 0.5em;
  33. background-color: #eee;
  34. padding: 0.5em;
  35. margin-bottom: 1em;
  36. }
  37. .education > .heading > h1 {
  38. font-weight: bold;
  39. }
  40. .education > .heading > .location {
  41. font-weight: bold;
  42. justify-self: end;
  43. text-align: end;
  44. }
  45. .education > .heading > .period {
  46. font-weight: lighter;
  47. }
  48. .education > h1 {
  49. font-weight: bold;
  50. }
  51. """
  52. end