Skip to content

Commit be4a6dc

Browse files
authored
Simplify nav
1 parent a0dd734 commit be4a6dc

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
<header role=banner class="bg-gray-900 text-white">
2-
<div y-y x-x=md p-l p-r class="pb-4 md:pb-0 text-center md:text-left">
3-
<a href="/" class="block px-3 py-2 md:py-4 md:text-right text-sm md:text-base font-bold italic uppercase leading-tight tracking-wide hover:bg-gray-800">
2+
<nav role="navigation" class="w-full flex items-center lg:px-16 text-base md:text-lg text-center">
3+
<div class="flex-grow max-w-md mr-auto">
4+
<%= search_form() %>
5+
</div>
6+
<a href="/" class="block px-3 py-2 md:py-4 text-right text-sm md:text-base font-bold italic uppercase leading-tight tracking-wide hover:bg-gray-800">
47
<span>Components <br>·Guide</span>
58
</a>
6-
<nav role="navigation" class="flex-grow sm:pl-8 lg:px-16 text-base md:text-lg text-center">
7-
<ul class="h-full grid grid-rows-2 md:grid-cols-3 flex flex-col md:flex-row justify-around items-stretch tracking-wide">
8-
<%= nav_items(@path_info) %>
9+
<ul class="h-full grid grid-rows-2 md:grid-cols-3 flex flex-col md:flex-row justify-around items-stretch tracking-wide">
10+
<%#= nav_items(@path_info) %>
911

10-
<% if false do %>
11-
<li class="py-1">
12-
<a href="/signin/github" class="inline-block md:block px-4 py-1 md:py-2 font-bold text-white bg-red-700 rounded" style="background: linear-gradient(0deg, #E0003C 0%, #FF493F 50%, #FF584A 100%);">
13-
<%= "Sign in with GitHub" %>
14-
</a>
15-
<% end %>
16-
</ul>
17-
</nav>
18-
</div>
12+
13+
<% if false do %>
14+
<li class="py-1">
15+
<a href="/signin/github" class="inline-block md:block px-4 py-1 md:py-2 font-bold text-white bg-red-700 rounded" style="background: linear-gradient(0deg, #E0003C 0%, #FF493F 50%, #FF584A 100%);">
16+
<%= "Sign in with GitHub" %>
17+
</a>
18+
<% end %>
19+
</ul>
20+
</nav>
1921
</header>

apps/components_guide_web/lib/components_guide_web/views/layout_view.ex

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,25 @@ defmodule ComponentsGuideWeb.LayoutView do
1414
# {"About", to: "/about"}
1515
]
1616

17-
defp search_form do
17+
def search_form do
18+
~E"""
19+
<form role=search action="/research" class="flex h-full px-2 items-center">
20+
<input type=text name=q placeholder="Search specs, packages, features" class="w-full py-1 px-4 bg-gray-800 text-white rounded-full border border-gray-600">
21+
</form>
22+
"""
23+
end
24+
25+
def search_form_item do
1826
~E"""
1927
<li class=row-span-3>
20-
<form role=search action="/research" class="flex h-full px-2 items-center">
21-
<input type=text name=q placeholder="Search specs, packages, features" class="w-full py-1 px-4 bg-gray-800 text-white rounded-full border border-gray-600">
22-
</form>
28+
<%= search_form() %>
2329
"""
2430
end
2531

2632
def nav_items(path_info) do
2733
[
2834
Enum.map(@nav_links, fn
29-
{:search} -> search_form()
35+
{:search} -> search_form_item()
3036
{title, to: to} -> nav_link_item(title: title, to: to, path_info: path_info)
3137
end)
3238
]

0 commit comments

Comments
 (0)