Class: TableRowComponent

Inherits:
Component show all
Defined in:
app/components/table_row_component.rb

Overview

TableRow — a table row.

Usage:

Table(celled: true) { |c|
  c.header {
    TableRow {
      TableCell(heading: true) { text "Name" }
      TableCell(heading: true) { text "Age" }
    }
  }
  TableRow {
    TableCell { text "Alice" }
    TableCell { text "30" }
  }
}

Constant Summary

Constants inherited from Component

Component::HTML_OPTIONS

Instance Method Summary collapse

Methods inherited from Component

default, #initialize, #render_in, slot

Constructor Details

This class inherits a constructor from Component

Instance Method Details

#to_sObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/components/table_row_component.rb', line 27

def to_s
  classes = [
    ("active" if active),
    ("positive" if positive),
    ("negative" if negative),
    ("warning" if warning),
    ("error" if error),
    ("disabled" if disabled)
  ].compact

  opts = {}
  opts[:class] = classes.join(" ") if classes.any?
  tag.tr(**merge_html_options(**opts)) { @content }
end