diff --git a/app/components/access_panels/similar_holdings_component.rb b/app/components/access_panels/similar_holdings_component.rb new file mode 100644 index 000000000..d34cd442b --- /dev/null +++ b/app/components/access_panels/similar_holdings_component.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module AccessPanels + class SimilarHoldingsComponent < ViewComponent::Base + def initialize(document:) + @id = document.id + super() + end + + def call + helpers.turbo_frame_tag 'similar_holdings', src: "https://semantic-search-demo.stanford.edu/similar/#{@id}" + end + end +end diff --git a/app/views/catalog/record/_metadata_panels.html.erb b/app/views/catalog/record/_metadata_panels.html.erb index 72d01f26e..67c7509d7 100644 --- a/app/views/catalog/record/_metadata_panels.html.erb +++ b/app/views/catalog/record/_metadata_panels.html.erb @@ -3,6 +3,7 @@ <%= render AccessPanels::CourseReservesComponent.new(document: document) %> <%= render AccessPanels::AtTheLibraryComponent.new(document: document) %> + <%= render AccessPanels::SimilarHoldingsComponent.new(document: document) %> <% context = capture do %> <%= render AccessPanels::AppearsInComponent.new(document: document) %> diff --git a/spec/components/access_panels/similar_holdings_component_spec.rb b/spec/components/access_panels/similar_holdings_component_spec.rb new file mode 100644 index 000000000..c79ef395e --- /dev/null +++ b/spec/components/access_panels/similar_holdings_component_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe AccessPanels::SimilarHoldingsComponent, type: :component do + pending "add some examples to (or delete) #{__FILE__}" + + # it "renders something useful" do + # expect( + # render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html + # ).to include( + # "Hello, components!" + # ) + # end +end