Class: Railsboot::StatComponent

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

Overview

ViewComponent: renders the stat block.

Instance Method Summary collapse

Constructor Details

#initialize(**html_attributes) ⇒ StatComponent

Returns a new instance of StatComponent.

Parameters:

  • 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

  • :tag (String)

    HTML tag to render for the element



31
32
33
34
35
36
37
38
39
# File 'app/components/railsboot/stat_component.rb', line 31

def initialize(**html_attributes)
  @html_attributes = html_attributes

  @html_attributes[:tag] = "div"
  @html_attributes[:class] = class_names(
    "border p-4 rounded",
    html_attributes[:class]
  )
end