basics.ex 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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) do
  16. supported_profiles = [:linked_in] |> Map.new(&{&1, nil})
  17. flat_profiles =
  18. assigns.profiles |> Map.new(&{&1.network |> Macro.underscore() |> String.to_atom(), &1.url})
  19. assigns = assigns |> Map.merge(supported_profiles) |> Map.merge(flat_profiles)
  20. ~H"""
  21. <dl>
  22. <dt class="location"><.pinpoint_icon /></dt>
  23. <dd class="location"><%= @location.city %></dd>
  24. <dt class="mail"><.email_icon /></dt>
  25. <dd class="mail"><a href={"mailto: #{@email}"}><%= @email %></a></dd>
  26. <%= if @linked_in do %>
  27. <dt class="linked_in"><.linked_in_icon /></dt>
  28. <dd class="linked_in"><a href={@linked_in}><%= @linked_in %></a></dd>
  29. <% end %>
  30. </dl>
  31. """
  32. end
  33. defp email_icon(assigns),
  34. do: ~H"""
  35. <svg
  36. version="1.1"
  37. id="Capa_1"
  38. viewBox="0 0 75.294 75.294"
  39. xmlns="http://www.w3.org/2000/svg"
  40. xmlns:xlink="http://www.w3.org/1999/xlink"
  41. xml:space="preserve"
  42. >
  43. <g>
  44. <path d="M66.097,12.089h-56.9C4.126,12.089,0,16.215,0,21.286v32.722c0,5.071,4.126,9.197,9.197,9.197h56.9 c5.071,0,9.197-4.126,9.197-9.197V21.287C75.295,16.215,71.169,12.089,66.097,12.089z M61.603,18.089L37.647,33.523L13.691,18.089 H61.603z M66.097,57.206h-56.9C7.434,57.206,6,55.771,6,54.009V21.457l29.796,19.16c0.04,0.025,0.083,0.042,0.124,0.065 c0.043,0.024,0.087,0.047,0.131,0.069c0.231,0.119,0.469,0.215,0.712,0.278c0.025,0.007,0.05,0.01,0.075,0.016 c0.267,0.063,0.537,0.102,0.807,0.102c0.001,0,0.002,0,0.002,0c0.002,0,0.003,0,0.004,0c0.27,0,0.54-0.038,0.807-0.102 c0.025-0.006,0.05-0.009,0.075-0.016c0.243-0.063,0.48-0.159,0.712-0.278c0.044-0.022,0.088-0.045,0.131-0.069 c0.041-0.023,0.084-0.04,0.124-0.065l29.796-19.16v32.551C69.295,55.771,67.86,57.206,66.097,57.206z" />
  45. </g>
  46. </svg>
  47. """
  48. defp linked_in_icon(assigns),
  49. do: ~H"""
  50. <svg viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg">
  51. <g fill="none" fill-rule="evenodd">
  52. <path
  53. d="M8,72 L64,72 C68.418278,72 72,68.418278 72,64 L72,8 C72,3.581722 68.418278,-8.11624501e-16 64,0 L8,0 C3.581722,8.11624501e-16 -5.41083001e-16,3.581722 0,8 L0,64 C5.41083001e-16,68.418278 3.581722,72 8,72 Z"
  54. fill="#007EBB"
  55. /><path
  56. d="M62,62 L51.315625,62 L51.315625,43.8021149 C51.315625,38.8127542 49.4197917,36.0245323 45.4707031,36.0245323 C41.1746094,36.0245323 38.9300781,38.9261103 38.9300781,43.8021149 L38.9300781,62 L28.6333333,62 L28.6333333,27.3333333 L38.9300781,27.3333333 L38.9300781,32.0029283 C38.9300781,32.0029283 42.0260417,26.2742151 49.3825521,26.2742151 C56.7356771,26.2742151 62,30.7644705 62,40.051212 L62,62 Z M16.349349,22.7940133 C12.8420573,22.7940133 10,19.9296567 10,16.3970067 C10,12.8643566 12.8420573,10 16.349349,10 C19.8566406,10 22.6970052,12.8643566 22.6970052,16.3970067 C22.6970052,19.9296567 19.8566406,22.7940133 16.349349,22.7940133 Z M11.0325521,62 L21.769401,62 L21.769401,27.3333333 L11.0325521,27.3333333 L11.0325521,62 Z"
  57. fill="#FFF"
  58. />
  59. </g>
  60. </svg>
  61. """
  62. defp pinpoint_icon(assigns),
  63. do: ~H"""
  64. <svg
  65. version="1.1"
  66. xmlns="http://www.w3.org/2000/svg"
  67. xmlns:xlink="http://www.w3.org/1999/xlink"
  68. viewBox="0 0 297 297"
  69. xml:space="preserve"
  70. >
  71. <g>
  72. <path d="M148.5,0C87.43,0,37.747,49.703,37.747,110.797c0,91.026,99.729,179.905,103.976,183.645 c1.936,1.705,4.356,2.559,6.777,2.559c2.421,0,4.841-0.853,6.778-2.559c4.245-3.739,103.975-92.618,103.975-183.645 C259.253,49.703,209.57,0,148.5,0z M148.5,272.689c-22.049-21.366-90.243-93.029-90.243-161.892 c0-49.784,40.483-90.287,90.243-90.287s90.243,40.503,90.243,90.287C238.743,179.659,170.549,251.322,148.5,272.689z" />
  73. <path d="M148.5,59.183c-28.273,0-51.274,23.154-51.274,51.614c0,28.461,23.001,51.614,51.274,51.614 c28.273,0,51.274-23.153,51.274-51.614C199.774,82.337,176.773,59.183,148.5,59.183z M148.5,141.901 c-16.964,0-30.765-13.953-30.765-31.104c0-17.15,13.801-31.104,30.765-31.104c16.964,0,30.765,13.953,30.765,31.104 C179.265,127.948,165.464,141.901,148.5,141.901z" />
  74. </g>
  75. </svg>
  76. """
  77. def css(),
  78. do: """
  79. #basics {
  80. display: grid;
  81. justify-items: center;
  82. }
  83. #basics > h1 {
  84. text-transform: uppercase;
  85. font-weight: 700;
  86. font-size: 2em;
  87. }
  88. #basics > h2 {
  89. text-transform: uppercase;
  90. color: #334960;
  91. opacity: 0.7;
  92. text-align: center;
  93. max-width: 30ch;
  94. }
  95. #contact dl {
  96. column-gap: 1em;
  97. }
  98. #contact dl > dt {
  99. justify-self: center;
  100. }
  101. #contact .mail a {
  102. font-weight: bold;
  103. }
  104. #contact dt.mail,
  105. #contact dt.linked_in,
  106. #contact dt.location {
  107. width: 30px;
  108. height: 30px;
  109. }
  110. """
  111. end