Class: BetterUi::General::Table::TfootComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/better_ui/general/table/tfoot_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(theme: :default, bordered: false, **html_options) ⇒ TfootComponent

Returns a new instance of TfootComponent.



7
8
9
10
11
# File 'app/components/better_ui/general/table/tfoot_component.rb', line 7

def initialize(theme: :default, bordered: false, **html_options)
  @theme = theme.to_sym
  @bordered = !!bordered
  @html_options = html_options
end

Instance Attribute Details

#borderedObject (readonly)

Returns the value of attribute bordered.



5
6
7
# File 'app/components/better_ui/general/table/tfoot_component.rb', line 5

def bordered
  @bordered
end

#themeObject (readonly)

Returns the value of attribute theme.



5
6
7
# File 'app/components/better_ui/general/table/tfoot_component.rb', line 5

def theme
  @theme
end

Instance Method Details

#tfoot_attributesObject



20
21
22
23
24
# File 'app/components/better_ui/general/table/tfoot_component.rb', line 20

def tfoot_attributes
  attrs = @html_options.except(:class)
  attrs[:class] = tfoot_classes
  attrs
end

#tfoot_classesObject



13
14
15
16
17
18
# File 'app/components/better_ui/general/table/tfoot_component.rb', line 13

def tfoot_classes
  [
    "bg-gray-50 border-t border-gray-200",
    @html_options[:class]
  ].compact.join(" ")
end