basics.ex 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. defmodule CvGenView.Basics do
  2. use Phoenix.Component
  3. attr(:name, :string, required: true)
  4. attr(:title, :string, required: true)
  5. def basics(assigns) do
  6. ~H"""
  7. <h1><%= @name %></h1>
  8. <h2><%= @title %></h2>
  9. """
  10. end
  11. def about(assigns),
  12. do: ~H"""
  13. <p><%= @summary %></p>
  14. """
  15. def contact(assigns),
  16. do: ~H"""
  17. <dl>
  18. <dt class="location">📍</dt>
  19. <dd class="location"><%= @location.city %></dd>
  20. <dt class="mail">📧</dt>
  21. <dd class="mail"><a href={"mailto: #{@email}"}><%= @email %></a></dd>
  22. <dt class="profiles"></dt>
  23. <dd class="profiles">
  24. <ul>
  25. <%= for profile <- @profiles do %>
  26. <li><a href={profile.url}><%= profile.network %></a></li>
  27. <% end %>
  28. </ul>
  29. </dd>
  30. </dl>
  31. """
  32. def css(),
  33. do: """
  34. #basics {
  35. display: grid;
  36. justify-items: center;
  37. }
  38. #basics > h1 {
  39. text-transform: uppercase;
  40. font-weight: 700;
  41. font-size: 2em;
  42. }
  43. #basics > h2 {
  44. text-transform: uppercase;
  45. color: #334960;
  46. opacity: 0.7;
  47. text-align: center;
  48. max-width: 30ch;
  49. }
  50. #contact dl {
  51. column-gap: 1em;
  52. }
  53. #contact .mail a {
  54. font-weight: bold;
  55. }
  56. """
  57. end