Class: Ariadne::HeaderComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/ariadne/header_component.rb

Overview

Represents the top navigation bar on every page.

Constant Summary collapse

DEFAULT_CLASSES =
"ariadne-sticky ariadne-top-0 ariadne-z-50 ariadne-px-4 ariadne-py-5 ariadne-bg-white ariadne-shadow-sm shadow-slate-900/5 ariadne-transition ariadne-duration-500"
"ariadne-rounded-lg ariadne-py-1 ariadne-px-2 text-slate-700 hover:bg-slate-100 hover:text-slate-900"
DEFAULT_TEXT_LOGO_CLASSES =
"ariadne-flex ariadne-items-center ariadne-font-bold ariadne-text-xl"
DEFAULT_IMAGE_LOGO_CLASSES =
"ariadne-h-10 ariadne-w-auto"
"ariadne-inline-block ariadne-rounded-lg ariadne-py-1 ariadne-px-2 ariadne-text-sm text-slate-700 hover:bg-slate-100 hover:text-slate-900"
"group ariadne-inline-flex ariadne-items-center ariadne-justify-center ariadne-rounded-full ariadne-py-2 ariadne-px-4 ariadne-text-sm ariadne-font-semibold focus:ariadne-outline-none focus-visible:outline-2 focus-visible:outline-offset-2"
"group ariadne-inline-flex ariadne-items-center ariadne-justify-center ariadne-rounded-full ariadne-py-2 ariadne-px-4 ariadne-text-sm ariadne-font-semibold focus:ariadne-outline-none focus-visible:outline-2 focus-visible:outline-offset-2"

Constants inherited from Component

Component::BASE_BODY_CLASSES, Component::BASE_HTML_CLASSES, Component::BASE_MAIN_CLASSES, Component::BASE_WRAPPER_CLASSES, Component::INVALID_ARIA_LABEL_TAGS

Constants included from ActionViewExtensions::FormHelper

ActionViewExtensions::FormHelper::DEFAULT_FORM_CLASSES

Constants included from Status::Dsl

Status::Dsl::STATUSES

Constants included from ViewHelper

ViewHelper::HELPERS

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::INTEGER_TYPES, FetchOrFallbackHelper::InvalidValueError, FetchOrFallbackHelper::TRUE_OR_FALSE

Instance Method Summary collapse

Methods included from ActionViewExtensions::FormHelper

#ariadne_form_with

Methods included from ClassNameHelper

#class_names

Methods included from LoggerHelper

#logger, #silence_deprecations?, #silence_warnings?

Methods included from FetchOrFallbackHelper

#check_incoming_attribute, #check_incoming_tag, #check_incoming_value, #fetch_or_raise, #fetch_or_raise_boolean, #fetch_or_raise_integer

Constructor Details

#initialize(classes: "", attributes: {}) ⇒ HeaderComponent

<%= render(Ariadne::HeaderComponent.new) do |header| %>

<%= header.logo(as_text: true) { "GitHub" } %>
<%= header.navigation_link(href: "#features") { "Features" } %>
<%= header.login_link(href: "/login") { "Login" } %>

<% end %>

Examples:

Basic example

Parameters:

  • classes (String) (defaults to: "")

    <%= link_to_classes_docs %>

  • attributes (Hash) (defaults to: {})

    <%= link_to_attributes_docs %>



85
86
87
88
89
90
91
92
# File 'app/components/ariadne/header_component.rb', line 85

def initialize(classes: "", attributes: {})
  @classes = class_names(
    DEFAULT_CLASSES,
    classes,
  )

  @attributes = attributes
end