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.35.2 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.35.1 app/lib/primer/underline_nav_helper.rb
primer_view_components-0.26.1 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.35.0 app/lib/primer/underline_nav_helper.rb
primer_view_components-0.26.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.34.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.33.2 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.33.1 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.33.0 app/lib/primer/underline_nav_helper.rb
primer_view_components-0.25.1 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.32.1 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.32.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.29.1 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.29.0 app/lib/primer/underline_nav_helper.rb
primer_view_components-0.23.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.28.1 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.28.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.27.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.26.0 app/lib/primer/underline_nav_helper.rb
openproject-primer_view_components-0.25.1 app/lib/primer/underline_nav_helper.rb