defmodule Materialize.Components.Navbar do @moduledoc """ Use module for generate HTML block navbar. Add alias in **/web/views/layout_view.ex** with configuration navbar: ```Elixir alias #{__MODULE__} def navbar do [ wrrape: [attr: [class: "nav-wrapper"]], logo: [href: "#", text: "Logo", attr: [class: "brand-logo"]], items: [ [tag: "ul", attr: [id: "nav-mobile", class: "right hide-on-med-and-down"], items: [ [tag: "a", text: "list 1", attr: [href: "#1"]], [tag: "a", text: "list 2", attr: [href: "#2"]] ]] ] ] |> Navbar.get_html() end ``` Use navbar in templates: ```Elixir <%= navbar %> ``` Result ```Html
``` """ alias Materialize.Html @wrapper_options [attr: [class: "nav-wrapper"]] @logo_options [tag: "a", text: "Logo", attr: [href: "#", class: "brand-logo"]] @items_options [tag: "ul", attr: [id: "nav-mobile", class: "right hide-on-med-and-down"]] # defstruct [wrapper: @wrapper_options, logo: @logo_options] @doc """ Create tag **span** or etc. ### Parameters - options: keyword list ### Example ```Elixie #{__MODULE__}.get_html([ wrrape: [attr: [class: "nav-wrapper"]], logo: [href: "#", text: "Logo", attr: [class: "brand-logo"]], items: [ [tag: "ul", attr: [id: "nav-mobile", class: "right hide-on-med-and-down"], items: [ [tag: "a", text: "list 1", attr: [href: "#1"]], [tag: "a", text: "list 2", attr: [href: "#2"]] ]] ] ]) ``` """ @spec get_html(Keyword.t) :: List.t def get_html(options) do options = check_options options attr = Html.get_attribute options[:wrapper] logo = Html.get_tag(options[:logo]) [start: "