Sha256: 295854aefd6d145442767d08d5297f06af8db1afa184afeac1184ee6238df74b

Contents?: true

Size: 1012 Bytes

Versions: 196

Compression:

Stored size: 1012 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Primer
  # Helper to share tab validation logic between components.
  # The component will raise an error if there are 0 or 2+ selected tabs.
  module UnderlineNavHelper
    extend ActiveSupport::Concern

    ALIGN_DEFAULT = :left
    ALIGN_OPTIONS = [ALIGN_DEFAULT, :right].freeze

    ACTIONS_TAG_DEFAULT = :div
    ACTIONS_TAG_OPTIONS = [ACTIONS_TAG_DEFAULT, :span].freeze

    def underline_nav_classes(classes, align)
      class_names(
        classes,
        "UnderlineNav",
        "UnderlineNav--right" => align == :right
      )
    end

    def underline_nav_body_classes(classes)
      class_names(
        "UnderlineNav-body",
        classes,
        "list-style-none"
      )
    end

    def underline_nav_action_classes(classes)
      class_names("UnderlineNav-actions", classes)
    end

    def underline_nav_tab_classes(classes)
      class_names(
        "UnderlineNav-item",
        classes
      )
    end
  end
end

Version data entries

196 entries across 196 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.49.2 app/lib/primer/underline_nav_helper.rb
primer_view_components-0.35.2 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.49.1 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.49.0 app/lib/primer/underline_nav_helper.rb
primer_view_components-0.35.1 app/lib/primer/underline_nav_helper.rb
primer_view_components-0.35.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.48.2 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.48.1 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.48.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.47.1 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.47.0 app/lib/primer/underline_nav_helper.rb
primer_view_components-0.34.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.46.1 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.46.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.45.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.44.3 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.44.2 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.44.1 app/lib/primer/underline_nav_helper.rb
primer_view_components-0.33.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.44.0 app/lib/primer/underline_nav_helper.rb