Class: Tailwinds::Table::RowComponent
- Inherits:
-
Tramway::Component::Base
- Object
- ViewComponent::Base
- Tramway::Component::Base
- Tailwinds::Table::RowComponent
- Defined in:
- app/components/tailwinds/table/row_component.rb
Overview
Component for rendering a row in a table
Instance Method Summary collapse
-
#desktop_row_classes(cells_count) ⇒ Object
:reek:UtilityFunction { enabled: false }.
-
#link_row_classes ⇒ Object
:reek:UtilityFunction { enabled: true }.
- #row_tag(**options) ⇒ Object
Methods included from Tramway::Helpers::ComponentHelper
Instance Method Details
#desktop_row_classes(cells_count) ⇒ Object
:reek:UtilityFunction { enabled: false }
28 29 30 31 32 33 |
# File 'app/components/tailwinds/table/row_component.rb', line 28 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', "grid-cols-#{cells_count}" ].join(' ') end |
#link_row_classes ⇒ Object
:reek:UtilityFunction { enabled: true }
36 37 38 |
# File 'app/components/tailwinds/table/row_component.rb', line 36 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 24 25 |
# File 'app/components/tailwinds/table/row_component.rb', line 11 def row_tag(**, &) default_attributes = { role: :row } if href.present? klass = "#{options[:class] || ''} #{link_row_classes}" link_to(href, .merge(class: klass, **default_attributes)) do yield if block_given? end else tag.div(**.merge(default_attributes)) do yield if block_given? end end end |