Sha256: 1ce4e25f3ff1aff7f9b7c3ce92900d2e43924479cc30504164f61057bc3e08b7
Contents?: true
Size: 1.78 KB
Versions: 3
Compression:
Stored size: 1.78 KB
Contents
# frozen_string_literal: true module Primer # Use the UnderlineNav component to style navigation with a minimal # underlined selected state, typically used for navigation placed at the top # of the page. class UnderlineNavComponent < Primer::Component ALIGN_DEFAULT = :left ALIGN_OPTIONS = [ALIGN_DEFAULT, :right].freeze with_content_areas :body, :actions # @example auto|Default # <%= render(Primer::UnderlineNavComponent.new) do |component| %> # <% component.with(:body) do %> # <%= render(Primer::LinkComponent.new(href: "#url")) { "Item 1" } %> # <% end %> # <% component.with(:actions) do %> # <%= render(Primer::ButtonComponent.new) { "Button!" } %> # <% end %> # <% end %> # # @example auto|Align right # <%= render(Primer::UnderlineNavComponent.new(align: :right)) do |component| %> # <% component.with(:body) do %> # <%= render(Primer::LinkComponent.new(href: "#url")) { "Item 1" } %> # <% end %> # <% component.with(:actions) do %> # <%= render(Primer::ButtonComponent.new) { "Button!" } %> # <% end %> # <% end %> # # @param align [Symbol] <%= one_of(Primer::UnderlineNavComponent::ALIGN_OPTIONS) %> - Defaults to <%= Primer::UnderlineNavComponent::ALIGN_DEFAULT %> # @param system_arguments [Hash] <%= link_to_system_arguments_docs %> def initialize(align: ALIGN_DEFAULT, **system_arguments) @align = fetch_or_fallback(ALIGN_OPTIONS, align, ALIGN_DEFAULT) @system_arguments = system_arguments @system_arguments[:tag] = :nav @system_arguments[:classes] = class_names( @system_arguments[:classes], "UnderlineNav", "UnderlineNav--right" => @align == :right ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems