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.12 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.12-x86_64-linux app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.12-x86_64-darwin app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.12-x64-mingw32 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.12-x64-mingw-ucrt app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.12-arm64-darwin app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.12-aarch64-linux app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.11 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.11-x86_64-linux app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.11-x86_64-darwin app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.11-x64-mingw32 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.11-x64-mingw-ucrt app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.11-arm64-darwin app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.11-aarch64-linux app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.10 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.10-x86_64-linux app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.10-x86_64-darwin app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.10-x64-mingw32 app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.10-x64-mingw-ucrt app/lib/ariadne/underline_nav_helper.rb
ariadne_view_components-0.0.10-arm64-darwin app/lib/ariadne/underline_nav_helper.rb