Class: Tailwinds::Table::RowComponent
Overview
Component for rendering a row in a table
Instance Method Summary
collapse
#tramway_back_button, #tramway_badge, #tramway_button, #tramway_cell, #tramway_container, #tramway_flash, #tramway_form_for, #tramway_header, #tramway_row, #tramway_table, #tramway_title
#component
#tramway_decorate
Instance Method Details
#desktop_row_classes(cells_count) ⇒ Object
25
26
27
28
29
30
|
# File 'app/components/tailwinds/table/row_component.rb', line 25
def desktop_row_classes(cells_count)
[
'div-table-row', 'grid', 'gap-4', 'bg-white', 'border-b', 'last:border-b-0', 'dark:bg-gray-800',
'dark:border-gray-700', "md:grid-cols-#{cells_count}", 'grid-cols-1'
].join(' ')
end
|
#link_row_classes ⇒ Object
32
33
34
|
# File 'app/components/tailwinds/table/row_component.rb', line 32
def link_row_classes
'cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700'
end
|
#row_tag(**options) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/components/tailwinds/table/row_component.rb', line 11
def row_tag(**options, &)
default_attributes = { role: :row }
if href.present?
link_to(href, options.merge(class: "#{options[:class] || ''} #{link_row_classes}", **default_attributes)) do
yield if block_given?
end
else
tag.div(**options, **default_attributes) do
yield if block_given?
end
end
end
|