Skip to content

Commit

Permalink
Merge pull request #87 from pepsico-ecommerce/fix-deprecations
Browse files Browse the repository at this point in the history
Fix deprecations
  • Loading branch information
dustinfarris authored Jun 23, 2023
2 parents d79cd65 + 2b8efa2 commit c990dd4
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .check.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## list of tools (see `mix check` docs for a list of default curated tools)
tools: [
{:credo, "mix credo -a"},
{:ex_unit, "mix coveralls"},
{:ex_unit, "mix coveralls --warnings-as-errors"},
{:audit, "mix deps.audit"},
]
]
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 25.0
elixir 1.13.4-otp-25
erlang 26.0.1
elixir 1.15.0-otp-26
2 changes: 1 addition & 1 deletion lib/components/modal.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ defmodule CrunchBerry.Components.Modal do
</button>
<% end %>
</div>
<%= live_component(@component, @opts) %>
<.live_component id={"#{@id}-component"} module={@component} {@opts} />
</div>
</div>
</div>
Expand Down
96 changes: 50 additions & 46 deletions lib/components/pagination.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,59 +55,63 @@ defmodule CrunchBerry.Components.Pagination do
end

@impl Phoenix.LiveComponent
def render(assigns) do
def render(%{page: %{total_pages: total_pages}} = assigns) when total_pages > 1 do
~H"""
<%= unless @page.total_pages <= 1 do %>
<nav aria-label={@name}>
<ul class={@classes[:list]}>
<%= if @page.page_number > 1 do %>
<li>
<nav aria-label={@name}>
<ul class={@classes[:list]}>
<%= if @page.page_number > 1 do %>
<li>
<button
class={"#{@classes[:previous]} #{@classes[:text]}"}
aria-label="Previous"
phx-click={@page_event_name}
phx-value-page={@page.page_number - 1}
>
<span aria-hidden="true">&laquo;</span>
<span class="sr-only">Previous</span>
</button>
</li>
<% end %>
<%= for page_num <- page_numbers(@page.page_number, @page.total_pages) do %>
<li>
<%= if page_num == "..." do %>
<span class={@classes[:ellipsis]}>
<%= page_num %>
</span>
<% else %>
<button
class={"#{@classes[:previous]} #{@classes[:text]}"}
aria-label="Previous"
phx-click={@page_event_name}
phx-value-page={@page.page_number - 1}
>
<span aria-hidden="true">&laquo;</span>
<span class="sr-only">Previous</span>
</button>
</li>
<% end %>
<%= for page_num <- page_numbers(@page.page_number, @page.total_pages) do %>
<li>
<%= if page_num == "..." do %>
<span class={@classes[:ellipsis]}>
<%= page_num %>
</span>
<% else %>
<button
class={
class={
"#{round_ends(page_num, @page.page_number, @page.total_pages)} #{maybe_active(page_num, @page.page_number, @classes)} #{@classes[:page]}"
}
phx-click={@page_event_name}
phx-value-page={page_num}
>
<%= page_num %>
</button>
<% end %>
</li>
<% end %>
<%= if @page.page_number < @page.total_pages do %>
<li>
<button
class={"#{@classes[:next]} #{@classes[:text]}"}
aria-label="Next"
phx-click={@page_event_name}
phx-value-page={@page.page_number + 1}
phx-value-page={page_num}
>
<span aria-hidden="true">&raquo;</span>
<span class="sr-only">Next</span>
<%= page_num %>
</button>
</li>
<% end %>
</ul>
</nav>
<% end %>
<% end %>
</li>
<% end %>
<%= if @page.page_number < @page.total_pages do %>
<li>
<button
class={"#{@classes[:next]} #{@classes[:text]}"}
aria-label="Next"
phx-click={@page_event_name}
phx-value-page={@page.page_number + 1}
>
<span aria-hidden="true">&raquo;</span>
<span class="sr-only">Next</span>
</button>
</li>
<% end %>
</ul>
</nav>
"""
end

def render(assigns) do
~H"""
<div></div>
"""
end

Expand Down
2 changes: 1 addition & 1 deletion lib/components/type_ahead.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ defmodule CrunchBerry.Components.TypeAhead do
def render(assigns) do
~H"""
<div class={class_or_default(assigns, :root)}>
<div class={class_or_default(assigns, :container)} >
<div class={class_or_default(assigns, :container)}>
<%= label(assigns.form, assigns.label, class: class_or_default(assigns, :label)) %>
<input
class={class_or_default(assigns, :input)}
Expand Down
Loading

0 comments on commit c990dd4

Please sign in to comment.