Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipeR13 committed Sep 13, 2024
1 parent f55b86c commit 02fc8c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
19 changes: 13 additions & 6 deletions lib/atomic_web/components/activity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ defmodule AtomicWeb.Components.Activity do
<!-- Image -->
<%= if @activity.image do %>
<div class="mt-4">
<img class="max-w-screen rounded-md sm:max-w-xl max-h-[32rem] object-cover" src={Uploaders.Post.url({@activity.image, @activity}, :original)} />
<img class="max-w-screen max-h-[32rem] rounded-md object-cover sm:max-w-xl" src={Uploaders.Post.url({@activity.image, @activity}, :original)} />
</div>
<% end %>
<!-- Footer -->
Expand All @@ -53,10 +53,14 @@ defmodule AtomicWeb.Components.Activity do
</span>
<span class="inline-flex items-center text-sm">
<span class="inline-flex space-x-2">
<.icon name={:user_group} solid class={[
"h-5 w-5",
color_class(@activity.enrolled, @activity.maximum_entries)
]} />
<.icon
name={:user_group}
solid
class={[
"h-5 w-5",
color_class(@activity.enrolled, @activity.maximum_entries)
]}
/>
<span class="font-medium text-gray-900"><%= @activity.enrolled %>/<%= @activity.maximum_entries %></span>
<span class="sr-only text-zinc-400">enrollments</span>
</span>
Expand All @@ -83,6 +87,9 @@ defmodule AtomicWeb.Components.Activity do
end

defp color_class(enrolled, maximum_entries) when enrolled == maximum_entries, do: "text-red-500"
defp color_class(enrolled, maximum_entries) when enrolled > div(maximum_entries,2), do: "text-amber-300"

defp color_class(enrolled, maximum_entries) when enrolled > div(maximum_entries, 2),
do: "text-amber-300"

defp color_class(_, _), do: "text-lime-600"
end
8 changes: 4 additions & 4 deletions lib/atomic_web/live/home_live/components/schedule.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule AtomicWeb.HomeLive.Components.Schedule do
</li>
</.link>
<.link navigate={Routes.organization_show_path(AtomicWeb.Endpoint, :show, entry.organization.id)}>
<div class="text-right text-zinc-400 pb-4">
<div class="pb-4 text-right text-zinc-400">
<p class="text-xs hover:underline">
<%= entry.organization.name %>
</p>
Expand Down Expand Up @@ -62,14 +62,14 @@ defmodule AtomicWeb.HomeLive.Components.Schedule do
<%= pretty_display_date(entry.start) %>
</p>
</div>
</div>
</div>
<p class="text-justify text-sm text-gray-700">
<%= truncate(entry.description, 150) %>
</p>
</li>
</.link>
<.link navigate={Routes.organization_show_path(AtomicWeb.Endpoint, :show, entry.organization.id)}>
<div class="text-right text-zinc-400 pb-4">
<div class="pb-4 text-right text-zinc-400">
<p class="text-xs hover:underline">
<%= entry.organization.name %>
</p>
Expand All @@ -85,7 +85,7 @@ defmodule AtomicWeb.HomeLive.Components.Schedule do

defp truncate(text, length) do
if String.length(text) > length do
String.slice(text, 0..length - 1) <> "..."
String.slice(text, 0..(length - 1)) <> "..."
else
text
end
Expand Down

0 comments on commit 02fc8c5

Please sign in to comment.