-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds the sorting order and renders the arrow on the table
- Loading branch information
1 parent
f901c95
commit ddb2f48
Showing
7 changed files
with
114 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
lib/app_web/templates/table_component/arrow_down.html.heex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<span class="ml-2 flex-none rounded bg-gray-100 text-gray-900 group-hover:bg-gray-200"> | ||
<svg | ||
class="h-5 w-5" | ||
viewBox="0 0 20 20" | ||
fill="currentColor" | ||
aria-hidden="true" | ||
> | ||
<path | ||
fill-rule="evenodd" | ||
d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" | ||
clip-rule="evenodd" | ||
/> | ||
</svg> | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<%= if @invisible do %> | ||
<span class="invisible ml-2 flex-none rounded text-gray-400 group-hover:visible group-focus:visible"> | ||
<svg | ||
class="invisible ml-2 h-5 rotate-180 w-5 flex-none rounded text-gray-400 group-hover:visible group-focus:visible" | ||
viewBox="0 0 20 20" | ||
fill="currentColor" | ||
aria-hidden="true" | ||
> | ||
<path | ||
fill-rule="evenodd" | ||
d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" | ||
clip-rule="evenodd" | ||
/> | ||
</svg> | ||
</span> | ||
<% else %> | ||
<span class="ml-2 flex-none rounded bg-gray-100 text-gray-900 group-hover:bg-gray-200"> | ||
<svg | ||
class="h-5 w-5 rotate-180" | ||
viewBox="0 0 20 20" | ||
fill="currentColor" | ||
aria-hidden="true" | ||
> | ||
<path | ||
fill-rule="evenodd" | ||
d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" | ||
clip-rule="evenodd" | ||
/> | ||
</svg> | ||
</span> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
defmodule AppWeb.TableComponentView do | ||
use AppWeb, :view | ||
|
||
def render_arrow_down() do | ||
Phoenix.View.render(AppWeb.TableComponentView, "arrow_down.html", %{}) | ||
end | ||
|
||
def render_arrow_up() do | ||
Phoenix.View.render(AppWeb.TableComponentView, "arrow_up.html", %{ | ||
invisible: false | ||
}) | ||
end | ||
|
||
def render_arrow_up(:invisible) do | ||
Phoenix.View.render(AppWeb.TableComponentView, "arrow_up.html", %{ | ||
invisible: true | ||
}) | ||
end | ||
end |