LedgerUI.Components.LandingNav (LedgerUI v0.2.0)

Copy Markdown View Source

The marketing-site top bar: the logo on the left, the links in the center (one may open a mega menu), Entrar and the primary button on the right.

<.landing_nav id="site-nav" brand={%{name: "Ledger", logo: "L", navigate: ~p"/"}}>
  <:link label="Produto">
    <.landing_mega>
      <.landing_feature icon="kanban" title="Projetos" description="Kanban, prazos" navigate={~p"/projetos"} />
    </.landing_mega>
  </:link>
  <:link label="Preços" navigate={~p"/precos"} active />
  <:actions>
    <.landing_login navigate={~p"/entrar"}>Entrar</.landing_login>
    <.landing_cta navigate={~p"/cadastro"}>Começar grátis</.landing_cta>
  </:actions>
</.landing_nav>

Variants

  • default - the classic bar, in the page flow.
  • float - a detached pill of frosted glass.
  • clear - transparent over a hero image; with sticky it turns solid once the page scrolls.
  • tint and dark - the accent wash and the near-black bar.
  • mobile - the phone layout at any width: logo and the menu button.

sticky pins the bar to the top (position: sticky) and mounts the LedgerUI.LandingNav hook, which sets data-stuck after stuck_after px of scroll. A :link with inner content is a trigger: a button with aria-expanded / aria-controls that opens the content as the mega menu (landing_mega/1), with hover (open_on="hover") or click; Escape and a click outside close it, arrows walk the items. The hook is mounted when there is a trigger, sticky or responsive.

responsive hides the links and the primary button below 768px and shows the menu button (a panel listing every link and the :actions again, so do not put an id inside :actions). The mobile variant always has the menu button. Without a :logo slot the brand map is used (%{name, navigate, logo | src | icon}: icon draws the bare icon beside the name, as in the canvas).

A :link with caret is a plain link with the "▾" after its label, for a mega menu that is drawn apart (landing_mega/1 beside the bar, as in the canvas).

Summary

Functions

The thin announcement strip above the bar; the close button hides it with JS.hide.

The primary button of the bar. A link when it has href, navigate or patch, else a button.

One feature of the mega menu: an icon in a box, the title and a line of description.

The "Entrar" link of the bar.

The mega menu content (inside a :link of landing_nav/1): the features and, optionally, a side panel.

The highlighted panel beside the features: an eyebrow, the title, the text, a thumbnail and a link.

A product card of landing_mega variant="cards": logo and name, a large title, a link and a preview.

Functions

landing_announcement(assigns)

The thin announcement strip above the bar; the close button hides it with JS.hide.

Attributes

  • id (:string) (required)
  • eyebrow (:string) - Defaults to nil.
  • link_label (:string) - Defaults to nil.
  • href (:string) - Defaults to "#".
  • navigate (:string) - Defaults to nil.
  • dismissible (:boolean) - Defaults to true.
  • close_label (:string) - Defaults to "Close".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

landing_cta(assigns)

The primary button of the bar. A link when it has href, navigate or patch, else a button.

Attributes

  • size (:string) - Defaults to "md". Must be one of "md", or "lg".
  • block (:boolean) - Defaults to false.
  • icon (:string) - Defaults to nil.
  • href (:string) - Defaults to nil.
  • navigate (:string) - Defaults to nil.
  • patch (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["disabled", "form", "name", "value", "phx-click"].

Slots

  • inner_block (required)

landing_feature(assigns)

One feature of the mega menu: an icon in a box, the title and a line of description.

Attributes

  • icon (:string) - Defaults to nil.
  • title (:string) (required)
  • description (:string) - Defaults to nil.
  • href (:string) - Defaults to "#".
  • navigate (:string) - Defaults to nil.
  • patch (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

landing_login(assigns)

The "Entrar" link of the bar.

Attributes

  • href (:string) - Defaults to "#".
  • navigate (:string) - Defaults to nil.
  • patch (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

landing_mega(assigns)

The mega menu content (inside a :link of landing_nav/1): the features and, optionally, a side panel.

Attributes

  • variant (:string) - Defaults to "default". Must be one of "default", or "cards".
  • columns (:integer) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)
  • side

landing_mega_side(assigns)

The highlighted panel beside the features: an eyebrow, the title, the text, a thumbnail and a link.

Attributes

  • eyebrow (:string) - Defaults to nil.
  • title (:string) (required)
  • thumb (:boolean) - Defaults to false.
  • link_label (:string) - Defaults to nil.
  • href (:string) - Defaults to "#".
  • navigate (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block

landing_nav(assigns)

Attributes

  • id (:string) (required)
  • variant (:string) - Defaults to "default". Must be one of "default", "float", "clear", "tint", "dark", or "mobile".
  • open_on (:string) - Defaults to "hover". Must be one of "hover", or "click".
  • sticky (:boolean) - Defaults to false.
  • stuck_after (:integer) - Defaults to 8.
  • responsive (:boolean) - Show the phone menu button below 768px. Defaults to false.
  • brand (:map) - Defaults to nil.
  • label (:any) - The accessible name of the links (nil leaves it out). Defaults to "Main".
  • menu_label (:string) - Defaults to "Menu".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • actions
  • link - Accepts attributes:
    • label (:string)
    • href (:string)
    • navigate (:string)
    • patch (:string)
    • active (:boolean)
    • caret (:boolean) - Adds the ▾ after the label, for a link that has its mega menu apart.
  • logo

landing_product(assigns)

A product card of landing_mega variant="cards": logo and name, a large title, a link and a preview.

Attributes

  • title (:string) (required)
  • name (:string) - Defaults to nil.
  • logo (:string) - Defaults to nil.
  • link_label (:string) - Defaults to nil.
  • tone (:string) - Defaults to "default". Must be one of "default", "tint", or "dark".
  • accent (:string) - Defaults to nil.
  • mock (:boolean) - Defaults to false.
  • compact (:boolean) - A static mini card (div): only the title, as in the canvas menu. Defaults to false.
  • href (:string) - Defaults to "#".
  • navigate (:string) - Defaults to nil.
  • patch (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • mark
  • preview