Sha256: 2411cd5e47ab535209ee55a6fbec3397787122aeb81786556e405f12a1876932

Contents?: true

Size: 1.54 KB

Versions: 5

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbVerticalNav
    class VerticalNav < Playbook::PbKit::Base
      PROPS = %i[configured_aria
                 configured_classname
                 configured_data
                 configured_id
                 configured_link
                 configured_title
                 block].freeze

      def initialize(aria: default_configuration,
                     classname: default_configuration,
                     data: default_configuration,
                     id: default_configuration,
                     link: default_configuration,
                     title: default_configuration,
                     &block)
        self.configured_aria = aria
        self.configured_classname = classname
        self.configured_data = data
        self.configured_id = id
        self.configured_link = link
        self.configured_title = title
        self.block = block_given? ? block : nil
      end

      def title
        if configured_title == default_configuration
          ""
        else
          configured_title
        end
      end

      def link
        if configured_link == default_configuration
          "#"
        else
          configured_link
        end
      end

      def yield(context:)
        context.capture(&block)
      end

      def to_partial_path
        "pb_vertical_nav/vertical_nav"
      end

    private

      DEFAULT = Object.new
      private_constant :DEFAULT
      def default_configuration
        DEFAULT
      end
      attr_accessor(*PROPS)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
playbook_ui-2.8.6 app/pb_kits/playbook/pb_vertical_nav/vertical_nav.rb
playbook_ui-2.8.5 app/pb_kits/playbook/pb_vertical_nav/vertical_nav.rb
playbook_ui-2.8.4 app/pb_kits/playbook/pb_vertical_nav/vertical_nav.rb
playbook_ui-2.8.3 app/pb_kits/playbook/pb_vertical_nav/vertical_nav.rb
playbook_ui-2.8.1 app/pb_kits/playbook/pb_vertical_nav/vertical_nav.rb