basics.ex 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. defmodule CvGenView.Basics do
  2. use Phoenix.Component
  3. alias CvGenView.Text
  4. attr(:name, :string, required: true)
  5. attr(:title, :string, required: true)
  6. def basics(assigns) do
  7. ~H"""
  8. <h1><%= @name %></h1>
  9. <h2><%= @title %></h2>
  10. """
  11. end
  12. def about(assigns),
  13. do: ~H"""
  14. <Text.text text={@summary}/>
  15. """
  16. def contact(assigns) do
  17. supported_profiles = [:linked_in] |> Map.new(&{&1, nil})
  18. flat_profiles =
  19. assigns.profiles |> Map.new(&{&1.network |> Macro.underscore() |> String.to_atom(), &1.url})
  20. assigns = assigns |> Map.merge(supported_profiles) |> Map.merge(flat_profiles)
  21. ~H"""
  22. <dl>
  23. <dt class="location"><.pinpoint_icon /></dt>
  24. <dd class="location"><%= @location.city %></dd>
  25. <dt class="mail"><.email_icon /></dt>
  26. <dd class="mail"><a href={"mailto: #{@email}"}><%= @email %></a></dd>
  27. <%= if @linked_in do %>
  28. <dt class="linked_in"><.linked_in_icon /></dt>
  29. <dd class="linked_in"><a href={@linked_in}><%= @linked_in %></a></dd>
  30. <% end %>
  31. </dl>
  32. """
  33. end
  34. defp email_icon(assigns),
  35. do: ~H"""
  36. <svg
  37. version="1.1"
  38. id="Capa_1"
  39. viewBox="0 0 75.294 75.294"
  40. xmlns="http://www.w3.org/2000/svg"
  41. xmlns:xlink="http://www.w3.org/1999/xlink"
  42. xml:space="preserve"
  43. >
  44. <g>
  45. <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" />
  46. </g>
  47. </svg>
  48. """
  49. defp linked_in_icon(assigns),
  50. do: ~H"""
  51. <svg viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg">
  52. <g fill="none" fill-rule="evenodd">
  53. <path
  54. 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"
  55. fill="#007EBB"
  56. /><path
  57. 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"
  58. fill="#FFF"
  59. />
  60. </g>
  61. </svg>
  62. """
  63. defp pinpoint_icon(assigns),
  64. do: ~H"""
  65. <svg
  66. version="1.1"
  67. xmlns="http://www.w3.org/2000/svg"
  68. xmlns:xlink="http://www.w3.org/1999/xlink"
  69. viewBox="0 0 297 297"
  70. xml:space="preserve"
  71. >
  72. <g>
  73. <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" />
  74. <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" />
  75. </g>
  76. </svg>
  77. """
  78. def css(),
  79. do: """
  80. #basics {
  81. display: grid;
  82. justify-items: center;
  83. }
  84. #basics > h1 {
  85. text-transform: uppercase;
  86. font-weight: 700;
  87. font-size: 2em;
  88. }
  89. #basics > h2 {
  90. text-transform: uppercase;
  91. color: #334960;
  92. opacity: 0.7;
  93. text-align: center;
  94. max-width: 30ch;
  95. }
  96. #contact dl {
  97. column-gap: 1em;
  98. }
  99. #contact dl > dt {
  100. justify-self: center;
  101. }
  102. #contact .mail a {
  103. font-weight: bold;
  104. }
  105. #contact dt.mail,
  106. #contact dt.linked_in,
  107. #contact dt.location {
  108. width: 30px;
  109. height: 30px;
  110. }
  111. """
  112. end