Sha256: e4662d6388025d7c0be23fcd740d1682d529d667587ba75e2d7f9eb646e1c92f

Contents?: true

Size: 728 Bytes

Versions: 4

Compression:

Stored size: 728 Bytes

Contents

# frozen_string_literal: true

#
# Renders a <div> for use with React components, with data attributes specifying the component path
# and props.
#
# If a content block is given, that content will be rendered inside the component, allowing for a
# "loading" UI. If no block is given, then a "loading..." text will be rendered. It is intended that
# the component is mounted to this div, and the loading UI will then be replaced with the
# component's rendered output.
#
class Proscenium::ViewComponent::ReactComponent < Proscenium::ViewComponent
  self.abstract_class = true

  include Proscenium::Componentable

  def call
    tag.send root_tag, data: data_attributes do
      tag.div content || 'loading...'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proscenium-0.10.0-x86_64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.10.0-aarch64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.10.0-arm64-darwin lib/proscenium/view_component/react_component.rb
proscenium-0.10.0-x86_64-darwin lib/proscenium/view_component/react_component.rb