Skip to content

fremantle-industries/navigator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Navigator

Build Status hex.pm version

Global navigation between multiple Phoenix endpoints, tailwindcss friendly

navigation

Installation

Add the navigator package to your list of dependencies in mix.exs:

def deps do
  [
    {:navigator, "~> 0.0.8"}
  ]
end

Usage

Configure the navigation links in config/config.exs

# config/config.exs
use Mix.Config

config :navigator,
  links: %{
    storefront: [
      %{
        label: "Storefront Home",
        to: {StorefrontWeb.Router.Helpers, :home_path, [StorefrontWeb.Endpoint, :index]},
        class: "text-4xl"
      },
      %{
        label: "Orders",
        to: {StorefrontWeb.Router.Helpers, :order_path, [StorefrontWeb.Endpoint, :index]}
      },
      %{
        label: "Admin",
        to: {AdminWeb.Router.Helpers, :home_url, [AdminWeb.Endpoint, :index]}
      }
    ],
    admin: [
      %{
        label: "Admin Home",
        to: {AdminWeb.Router.Helpers, :home_path, [AdminWeb.Endpoint, :index]},
        class: "text-4xl"
      },
      %{
        label: "Order Admin",
        to: {AdminWeb.Router.Helpers, :order_path, [AdminWeb.Endpoint, :index]}
      },
    ]
  }

Render the navigation in your phoenix templates

<%= render Navigator, "horizontal.html", conn: @conn %>

Authors

License

navigator is released under the MIT license

About

Global navigation between multiple Phoenix endpoints

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages