Sha256: d83a8fc54f368d50e9210d5b04ee56012d695b51e739837aec052b794724e200

Contents?: true

Size: 987 Bytes

Versions: 122

Compression:

Stored size: 987 Bytes

Contents

# frozen_string_literal: true

module Ariadne
  # Represents a linear timeline of events. Typically, this is shown
  # as part of the Conversation component.
  class TimelineComponent < Ariadne::Component
    DEFAULT_TAG = :div
    DEFAULT_CLASSES = ""

    # The sub-items(s) to render
    renders_many :items, lambda { |static_content = nil, &block|
      next static_content if static_content.present?

      view_context.capture { block&.call }
    }

    # @example Default
    #
    #   <%= render(Ariadne::TimelineComponent.new) { "Example" } %>
    #
    # @param tag [Symbol, String] The rendered tag name
    # @param classes [String] <%= link_to_classes_docs %>
    # @param attributes [Hash] <%= link_to_attributes_docs %>
    def initialize(tag: DEFAULT_TAG, classes: "", attributes: {})
      @tag = check_incoming_tag(DEFAULT_TAG, tag)
      @classes = merge_class_names(
        DEFAULT_CLASSES,
        classes,
      )

      @attributes = attributes
    end
  end
end

Version data entries

122 entries across 122 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.45-x86_64-darwin app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.45-arm64-darwin app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.45-x86_64-linux app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.45-aarch64-linux app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.44-aarch64-linux app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.44-arm64-darwin app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.44-x86_64-linux app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.44-x86_64-darwin app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.44-x64-mingw-ucrt app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.44 app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.39-x86_64-darwin app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.39-x86_64-linux app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.39-x64-mingw32 app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.39-aarch64-linux app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.39-x64-mingw-ucrt app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.39-arm64-darwin app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.39 app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.38-x64-mingw32 app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.38-aarch64-linux app/components/ariadne/timeline_component.rb
ariadne_view_components-0.0.38-x86_64-darwin app/components/ariadne/timeline_component.rb