education.ex 1.2 KB

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