Sha256: 48b4e915dcb8cea55a30c0e45e51b7a8a2c57e50dbd1b806de38baa18ec37961

Contents?: true

Size: 691 Bytes

Versions: 24

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

class Avo::Index::FieldWrapperComponent < ViewComponent::Base
  def initialize(field: nil, dash_if_blank: true, center_content: false, flush: false, **args)
    @field = field
    @dash_if_blank = dash_if_blank
    @center_content = center_content
    @classes = args[:class].present? ? args[:class] : ""
    @args = args
    @flush = flush
  end

  def classes
    result = @classes

    unless @flush
      result += " py-3"
    end

    result += " #{text_align_classes}"

    result
  end

  private

  def text_align_classes
    case @field.index_text_align.to_sym
    when :right
      'text-right'
    when :center
      'text-center'
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
avo-2.7.1.pre.1 app/components/avo/index/field_wrapper_component.rb
avo-2.7.0 app/components/avo/index/field_wrapper_component.rb
avo-2.6.1.pre.2 app/components/avo/index/field_wrapper_component.rb
avo-2.6.1.pre.1 app/components/avo/index/field_wrapper_component.rb
avo-2.6.0 app/components/avo/index/field_wrapper_component.rb
avo-2.5.2.pre.7 app/components/avo/index/field_wrapper_component.rb
avo-2.5.2.pre.6 app/components/avo/index/field_wrapper_component.rb
avo-2.5.2.pre.5 app/components/avo/index/field_wrapper_component.rb
avo-2.5.2.pre.4 app/components/avo/index/field_wrapper_component.rb
avo-2.5.2.pre.3 app/components/avo/index/field_wrapper_component.rb
avo-2.5.2.pre.2 app/components/avo/index/field_wrapper_component.rb
avo-2.5.2.pre.1 app/components/avo/index/field_wrapper_component.rb
avo-2.5.1 app/components/avo/index/field_wrapper_component.rb
avo-2.5.0 app/components/avo/index/field_wrapper_component.rb
avo-2.4.1 app/components/avo/index/field_wrapper_component.rb
avo-2.4.0 app/components/avo/index/field_wrapper_component.rb
avo-2.3.1.pre.6 app/components/avo/index/field_wrapper_component.rb
avo-2.3.1.pre.5 app/components/avo/index/field_wrapper_component.rb
avo-2.3.1.pre.4 app/components/avo/index/field_wrapper_component.rb
avo-2.3.1.pre.3 app/components/avo/index/field_wrapper_component.rb