Browse Source

active links in navbar

pull/26/head
Inhji Y. 1 year ago
parent
commit
8ccb743d3e
  1. 9
      apps/tomie_web/assets/css/app.css
  2. 3
      apps/tomie_web/lib/tomie_web.ex
  3. 14
      apps/tomie_web/lib/tomie_web/templates/layout/app.html.eex
  4. 1
      apps/tomie_web/mix.exs
  5. 1
      mix.lock

9
apps/tomie_web/assets/css/app.css

@ -76,14 +76,15 @@ nav > ul > li {
@apply flex-auto;
}
nav > ul > li > a:hover {
@apply bg-on-navbar text-navbar;
}
nav > ul > li > a {
@apply p-5 h-16 inline-block;
}
nav > ul > li > a:hover,
nav > ul > li > a.active {
@apply bg-on-navbar text-navbar;
}
nav > ul > li > a .icon {
@apply inline-block w-4 h-4;
}

3
apps/tomie_web/lib/tomie_web.ex

@ -39,6 +39,9 @@ defmodule TomieWeb do
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
# Import external modules
import PhoenixActiveLink
import TomieWeb.ErrorHelpers
import TomieWeb.Gettext
alias TomieWeb.Router.Helpers, as: Routes

14
apps/tomie_web/lib/tomie_web/templates/layout/app.html.eex

@ -11,9 +11,9 @@
<body class="mt-16 transition duration-500" data-theme="<%= theme(@conn) %>">
<nav role="navigation">
<ul>
<li><%= link "Home", to: Routes.page_path(@conn, :index) %></li>
<li><%= link "Bookmarks", to: Routes.bookmark_path(@conn, :index) %></li>
<li><%= link "Tags", to: Routes.tag_path(@conn, :index) %></li>
<li><%= active_link @conn, "Home", to: Routes.page_path(@conn, :index) %></li>
<li><%= active_link @conn, "Bookmarks", to: Routes.bookmark_path(@conn, :index) %></li>
<li><%= active_link @conn, "Tags", to: Routes.tag_path(@conn, :index) %></li>
<li class="spacer" />
<li>
<a href="#" class="theme-toggle">
@ -25,17 +25,17 @@
</a>
</li>
<%= unless Pow.Plug.current_user(@conn) do %>
<li><%= link "Register", to: Routes.pow_registration_path(@conn, :new) %></li>
<li><%= link "Sign in", to: Routes.pow_session_path(@conn, :new) %></li>
<li><%= active_link @conn, "Register", to: Routes.pow_registration_path(@conn, :new) %></li>
<li><%= active_link @conn, "Sign in", to: Routes.pow_session_path(@conn, :new) %></li>
<% else %>
<li>
<a href="<%= Routes.profile_path(@conn, :show) %>">
<%= active_link @conn, to: Routes.profile_path(@conn, :show) do %>
<span class="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path d="M5 5a5 5 0 0 1 10 0v2A5 5 0 0 1 5 7V5zM0 16.68A19.9 19.9 0 0 1 10 14c3.64 0 7.06.97 10 2.68V20H0v-3.32z"/>
</svg>
</span>
</a>
<% end %>
</li>
<% end %>
</ul>

1
apps/tomie_web/mix.exs

@ -43,6 +43,7 @@ defmodule TomieWeb.MixProject do
{:phoenix_ecto, "~> 4.0"},
{:phoenix_html, "~> 2.11"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_active_link, "~> 0.3.0"},
{:gettext, "~> 0.11"},
{:jason, "~> 1.0"},
{:plug_cowboy, "~> 2.0"},

1
mix.lock

@ -35,6 +35,7 @@
"open_graph_extended": {:git, "https://git.inhji.de/inhji/open_graph.git", "bed84f89524ec5ba12ab85018ff6f166cfff7a3d", []},
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"},
"phoenix": {:hex, :phoenix, "1.4.16", "2cbbe0c81e6601567c44cc380c33aa42a1372ac1426e3de3d93ac448a7ec4308", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.8.1 or ~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "856cc1a032fa53822737413cf51aa60e750525d7ece7d1c0576d90d7c0f05c24"},
"phoenix_active_link": {:hex, :phoenix_active_link, "0.3.0", "7c04e68aec9ea545fb2c3bba9d30518c84b7bd6c366c8c8df7b2e7c0ee0f6768", [:mix], [{:phoenix_html, "~> 2.10", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "3041b5e039bf0385b46db329255a453c28ce8e8afde44adb7e946ff66095895c"},
"phoenix_ecto": {:hex, :phoenix_ecto, "4.1.0", "a044d0756d0464c5a541b4a0bf4bcaf89bffcaf92468862408290682c73ae50d", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "c5e666a341ff104d0399d8f0e4ff094559b2fde13a5985d4cb5023b2c2ac558b"},
"phoenix_html": {:hex, :phoenix_html, "2.14.1", "7dabafadedb552db142aacbd1f11de1c0bbaa247f90c449ca549d5e30bbc66b4", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "536d5200ad37fecfe55b3241d90b7a8c3a2ca60cd012fc065f776324fa9ab0a9"},
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.2.1", "274a4b07c4adbdd7785d45a8b0bb57634d0b4f45b18d2c508b26c0344bd59b8f", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "41b4103a2fa282cfd747d377233baf213c648fdcc7928f432937676532490eee"},

Loading…
Cancel
Save