Sha256: a074e29e253a1379604c22374cea991451f8ca8e1015ea6843325c8d04671e1c

Contents?: true

Size: 698 Bytes

Versions: 2

Compression:

Stored size: 698 Bytes

Contents

module Lookbook
  class Embed::Component < Lookbook::BaseComponent
    def initialize(id:, example:, params: {}, opts: {}, max_height: nil, **html_attrs)
      @id = id
      @target = example
      @params = params
      @opts = opts
      @max_height = max_height
      super(**html_attrs)
    end

    protected

    def lookbook_inspect_path(*args)
      Lookbook::Engine.routes.url_helpers.lookbook_inspect_path(*args)
    end

    def lookbook_preview_path(*args)
      Lookbook::Engine.routes.url_helpers.lookbook_preview_path(*args)
    end

    def alpine_data
      [@id.to_json, "$store.pages.embeds"].join(",")
    end

    def alpine_component
      "embedComponent"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lookbook-1.0.3 app/components/lookbook/embed/component.rb
lookbook-1.0.2 app/components/lookbook/embed/component.rb