Class: Tailwinds::Table::RowComponent

Inherits:
Tramway::Component::Base show all
Defined in:
app/components/tailwinds/table/row_component.rb

Overview

Component for rendering a row in a table

Instance Method Summary collapse

Methods included from Tramway::Helpers::ComponentHelper

#component

Instance Method Details

#row_tag(**options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/components/tailwinds/table/row_component.rb', line 10

def row_tag(**options, &)
  if href.present?
    klass = "#{options[:class] || ''} cursor-pointer hover:bg-gray-700"

    link_to(href, options.merge(class: klass)) do
      yield if block_given?
    end
  else
    tag.div(**options) do
      yield if block_given?
    end
  end
end