Class: Railsboot::TestimonialComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/railsboot/testimonial_component.rb

Overview

Renders a testimonial with a quote, the person's name, and their role.

Instance Method Summary collapse

Constructor Details

#initialize(name: "", role: "", **html_attributes) ⇒ TestimonialComponent

Returns a new instance of TestimonialComponent.

Parameters:

  • name (String) (defaults to: "")

    the name option

  • role (String) (defaults to: "")

    the role option

  • html_attributes (Hash)

    additional HTML attributes applied to the rendered element

Options Hash (**html_attributes):

  • :class (String)

    additional CSS classes, merged with the component's own classes



22
23
24
25
26
27
28
29
30
31
32
# File 'app/components/railsboot/testimonial_component.rb', line 22

def initialize(name: "", role: "", **html_attributes)
  @name = name
  @role = role
  @html_attributes = html_attributes

  @html_attributes[:class] = class_names(
    "bg-primary bg-opacity-5",
    "border-0",
    html_attributes[:class]
  )
end