Sha256: b4d720ef5b0dd1243a1f8dc0415c363ddd7723df27fba2d54bfd4f3a49ae74c5

Contents?: true

Size: 747 Bytes

Versions: 124

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

module Proscenium
  # 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 ViewComponent::ReactComponent < ViewComponent
    self.abstract_class = true

    include ReactComponentable

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

Version data entries

124 entries across 124 versions & 1 rubygems

Version Path
proscenium-0.15.0.beta.5-x86_64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.5-aarch64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.5-arm64-darwin lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.5-x86_64-darwin lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.4-x86_64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.4-aarch64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.4-arm64-darwin lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.4-x86_64-darwin lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.3-x86_64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.3-aarch64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.3-arm64-darwin lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.3-x86_64-darwin lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.2-x86_64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.2-aarch64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.2-arm64-darwin lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.2-x86_64-darwin lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.1-x86_64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.1-aarch64-linux lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.1-arm64-darwin lib/proscenium/view_component/react_component.rb
proscenium-0.15.0.beta.1-x86_64-darwin lib/proscenium/view_component/react_component.rb