Sha256: bc3df7b92c70fec5873b8801b9a63bb681300d43848b247e2558481b30bfc583

Contents?: true

Size: 889 Bytes

Versions: 1

Compression:

Stored size: 889 Bytes

Contents

class DefinitionComponentPreview < ViewComponent::Preview
  class TempObj
    def self.human_attribute_name(_)
      'label'
    end

    def fieldname
      'value'
    end
  end

  layout false

  def default
    temp_obj = TempObj.new
    render(DefinitionComponent.new(label: nil, value: nil, obj: temp_obj, fieldname: :fieldname, options: {}))
  end

  def with_label
    temp_obj = TempObj.new
    render(DefinitionComponent.new(label: 'custom label', value: nil, obj: temp_obj, fieldname: :fieldname, options: {}))
  end

  def with_value
    temp_obj = TempObj.new
    render(DefinitionComponent.new(label: nil, value: 'custom value', obj: temp_obj, fieldname: :fieldname, options: {}))
  end

  def with_options
    temp_obj = TempObj.new
    render(DefinitionComponent.new(label: nil, value: nil, obj: temp_obj, fieldname: :fieldname, options: { style: 'color:red' }))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alveole-0.0.1 lib/alveole/previews/definition_component_preview.rb