Sha256: f96c216b877dd1ad20e2a7c979d232b5a9552e76c12295662e7ecd0e157d9a36

Contents?: true

Size: 1013 Bytes

Versions: 30

Compression:

Stored size: 1013 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Ariadne
  # 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

30 entries across 30 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.10-aarch64-linux app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.9 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.8 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.7 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.6 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.5 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.4 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.3 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.2 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.1 app/lib/ariadne/underline_nav_helper.rb