defmodule CvGenView.Basics do
use Phoenix.Component
alias CvGenView.Text
attr(:name, :string, required: true)
attr(:title, :string, required: true)
def basics(assigns) do
~H"""
<%= @name %>
<%= @title %>
"""
end
def about(assigns),
do: ~H"""
"""
def contact(assigns) do
supported_profiles = [:linked_in] |> Map.new(&{&1, nil})
flat_profiles =
assigns.profiles |> Map.new(&{&1.network |> Macro.underscore() |> String.to_atom(), &1.url})
assigns = assigns |> Map.merge(supported_profiles) |> Map.merge(flat_profiles)
~H"""
<.pinpoint_icon />
<%= @location.city %>
<.email_icon />
<%= @email %>
<%= if @linked_in do %>
<.linked_in_icon />
<%= @linked_in %>
<% end %>
"""
end
defp email_icon(assigns),
do: ~H"""
"""
defp linked_in_icon(assigns),
do: ~H"""
"""
defp pinpoint_icon(assigns),
do: ~H"""
"""
def css(),
do: """
#basics {
display: grid;
justify-items: center;
}
#basics > h1 {
text-transform: uppercase;
font-weight: 700;
font-size: 2em;
}
#basics > h2 {
text-transform: uppercase;
color: #334960;
opacity: 0.7;
text-align: center;
max-width: 30ch;
}
#contact dl {
column-gap: 1em;
}
#contact dl > dt {
justify-self: center;
}
#contact .mail a {
font-weight: bold;
}
#contact dt.mail,
#contact dt.linked_in,
#contact dt.location {
width: 30px;
height: 30px;
}
"""
end