Sha256: 63bff77f00c4402372c5679e737035fabb8908dc7e1d110801f5b6f9a3884267

Contents?: true

Size: 773 Bytes

Versions: 21

Compression:

Stored size: 773 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.with_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

21 entries across 21 versions & 2 rubygems

Version Path
blacklight-8.0.0.beta1 app/components/blacklight/header_component.rb