Sha256: 63e52b65be7a5fb9ba04fea3289695539cd4b3f97f4662c368250f2b57e13e86

Contents?: true

Size: 907 Bytes

Versions: 12

Compression:

Stored size: 907 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbNav
    class Item
      include Playbook::Props

      partial "pb_nav/item"

      prop :active, type: Playbook::Props::Boolean, default: false
      prop :link
      prop :text
      prop :icon_left
      prop :icon_right
      prop :image_url
      prop :target, type: Playbook::Props::Enum,
                    values: %w[_blank _self _parent _top],
                    default: "_self"
      def classname
        generate_classname("pb_nav_list_kit_item", active_class)
      end

      def tag
        link ? "a" : "div"
      end

      def options
        {
          class: "pb_nav_list_item_link",
        }.compact
      end

      def link_options
        options.merge(
          href: link,
          target: target
        )
      end

    private

      def active_class
        active ? "active" : nil
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
playbook_ui-7.14.0.pre.alpha1 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.16.0 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.15.1 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.15.0 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.14.0 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.13.0 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.12.1 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.12.0 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.11.1 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.11.0 app/pb_kits/playbook/pb_nav/item.rb
playbook_ui-7.11.0.pre.alpha1 app/pb_kits/playbook/pb_nav/item.rb