Skip to content

Commit

Permalink
Merge branch 'develop' into sf/improve-index-and-show-partners-pages-…
Browse files Browse the repository at this point in the history
…design
  • Loading branch information
faria-s authored Dec 2, 2024
2 parents 52b4be0 + 674572d commit acbd1c6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/atomic_web/components/sidebar.ex
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ defmodule AtomicWeb.Components.Sidebar do

defp user_image(user) do
if user.profile_picture do
Uploaders.ProfilePicture.url({user, user.profile_picture}, :original)
Uploaders.ProfilePicture.url({user.profile_picture, user}, :original)
else
nil
end
Expand Down
43 changes: 43 additions & 0 deletions lib/atomic_web/components/socials.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
defmodule AtomicWeb.Components.Socials do
@moduledoc false

use AtomicWeb, :component

attr :entity, :map, required: true

def socials(assigns) do
assigns = assign(assigns, :socials_with_values, get_social_values(assigns.entity))

~H"""
<div class="grid grid-cols-2 gap-2 md:flex md:flex-row">
<%= for {social, icon, url_base, social_value} <- @socials_with_values do %>
<%= if social_value do %>
<div class="flex flex-row items-center gap-x-2">
<img src={"/images/" <> icon} class="h-5 w-5" alt={Atom.to_string(social)} />
<.link class="capitalize text-blue-500" target="_blank" href={url_base <> social_value}>
<%= Atom.to_string(social) %>
</.link>
</div>
<% end %>
<% end %>
</div>
"""
end

defp get_social_values(entity) do
get_socials()
|> Enum.map(fn {social, icon, url_base} ->
social_value = Map.get(entity, social)
{social, icon, url_base, social_value}
end)
end

def get_socials do
[
{:tiktok, "tiktok.svg", "https://tiktok.com/"},
{:instagram, "instagram.svg", "https://instagram.com/"},
{:facebook, "facebook.svg", "https://facebook.com/"},
{:x, "x.svg", "https://x.com/"}
]
end
end
1 change: 1 addition & 0 deletions lib/atomic_web/live/partner_live/form_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ defmodule AtomicWeb.PartnerLive.FormComponent do
<.field field={socials_form[:instagram]} type="text" class="w-full" />
<.field field={socials_form[:facebook]} type="text" class="w-full" />
<.field field={socials_form[:x]} type="text" class="w-full" />
<.field field={socials_form[:tiktok]} type="text" class="w-full" />
<.field field={socials_form[:website]} type="text" class="w-full" />
</.inputs_for>
</div>
Expand Down
1 change: 1 addition & 0 deletions lib/atomic_web/live/partner_live/show.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ defmodule AtomicWeb.PartnerLive.Show do

import AtomicWeb.Components.{Avatar, Gradient, Tabs}


alias Atomic.Accounts
alias Atomic.Organizations
alias Atomic.Partners
Expand Down

0 comments on commit acbd1c6

Please sign in to comment.