Sha256: f3c763d3d22cf3bf11914968b20662e325ec36f5f9688c0fd841c6548c32180a

Contents?: true

Size: 572 Bytes

Versions: 4

Compression:

Stored size: 572 Bytes

Contents

# frozen_string_literal: true

class FoxTail::ListGroupComponent < FoxTail::BaseComponent
  renders_many :items, lambda { |options = {}|
    options[:flush] = flush?
    options[:theme] = theme.theme :item
    FoxTail::ListGroup::ItemComponent.new options
  }

  has_option :flush, type: :boolean, default: false

  def render?
    items?
  end

  def before_render
    super

    html_attributes[:class] = classnames theme.apply(:root, self), html_class
  end

  def call
    content_tag :div, html_attributes do
      items.each { |item| concat item }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fox_tail-0.2.1 app/components/fox_tail/list_group_component.rb
fox_tail-0.2.0 app/components/fox_tail/list_group_component.rb
fox_tail-0.1.1 app/components/fox_tail/list_group_component.rb
fox_tail-0.1.0 app/components/fox_tail/list_group_component.rb