Sha256: 7086cc16f986de15e274e7cb3eb671424f6d818bfdc06bfa8d35fb2019d5e559

Contents?: true

Size: 1005 Bytes

Versions: 7

Compression:

Stored size: 1005 Bytes

Contents

require 'bh/classes/base'

module Bh
  module Classes
    # @api private
    class Nav < Base
      # @return [#to_s] the style-related class to assign to the nav.
      def style_class
        Nav.styles[@options[:as]]
      end

      # @return [#to_s] the layout-related class to assign to the nav.
      def layout_class
        Nav.layouts[@options[:layout]]
      end

    private

      # @return [Hash<Symbol, String>] the classes that Bootstrap requires to
      #   append to navs for each possible style.
      def self.styles
        HashWithIndifferentAccess.new(:'nav-tabs').tap do |klass|
          klass[:pills] = :'nav-pills'
        end
      end

      # @return [Hash<Symbol, String>] the classes that Bootstrap requires to
      #   append to buttons for each possible layout.
      def self.layouts
        HashWithIndifferentAccess.new.tap do |klass|
          klass[:justified] = :'nav-justified'
          klass[:stacked]   = :'nav-stacked'
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bh-1.3.6 lib/bh/classes/nav.rb
bh-1.3.5 lib/bh/classes/nav.rb
bh-1.3.4 lib/bh/classes/nav.rb
bh-1.3.3 lib/bh/classes/nav.rb
bh-1.3.1 lib/bh/classes/nav.rb
bh-1.3.0 lib/bh/classes/nav.rb
bh-1.2.0 lib/bh/classes/nav.rb