Sha256: 71ba1372d44cec4ec720252b99a5e154440ab2af55fa2515e32e1c1831fd0b04

Contents?: true

Size: 768 Bytes

Versions: 10

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  class HeaderComponent < Blacklight::Component
    renders_one :top_bar, lambda { |component: Blacklight::TopNavbarComponent|
      component.new(blacklight_config: blacklight_config)
    }

    renders_one :search_bar, lambda { |component: Blacklight::SearchNavbarComponent|
      component.new(blacklight_config: blacklight_config)
    }

    def initialize(blacklight_config:)
      @blacklight_config = blacklight_config
    end

    attr_reader :blacklight_config

    # Hack so that the default lambdas are triggered
    # so that we don't have to do c.top_bar() in the call.
    def before_render
      set_slot(:top_bar, nil) unless top_bar
      set_slot(:search_bar, nil) unless search_bar
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
blacklight-7.40.0 app/components/blacklight/header_component.rb
blacklight-7.39.0 app/components/blacklight/header_component.rb
blacklight-7.38.0 app/components/blacklight/header_component.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/app/components/blacklight/header_component.rb
blacklight-7.37.0 app/components/blacklight/header_component.rb
blacklight-7.36.2 app/components/blacklight/header_component.rb
blacklight-7.36.1 app/components/blacklight/header_component.rb
blacklight-7.36.0 app/components/blacklight/header_component.rb
blacklight-7.35.0 app/components/blacklight/header_component.rb
blacklight-7.34.0 app/components/blacklight/header_component.rb