Sha256: 8f8c75572448e31cd57f808749163dc940485207b39ab4243f86d5098eb044fd

Contents?: true

Size: 1012 Bytes

Versions: 2

Compression:

Stored size: 1012 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

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

2 entries across 2 versions & 1 rubygems

Version Path
yattho_view_components-0.1.1 app/lib/yattho/underline_nav_helper.rb
yattho_view_components-0.0.1 app/lib/yattho/underline_nav_helper.rb