Class: RBUI::TypographyList

Inherits:
Base
  • Object
show all
Defined in:
lib/rbui/typography/typography_list.rb

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#before_template

Constructor Details

#initialize(items: [], numbered: false, **attrs) ⇒ TypographyList

Returns a new instance of TypographyList.



5
6
7
8
9
# File 'lib/rbui/typography/typography_list.rb', line 5

def initialize(items: [], numbered: false, **attrs)
  @items = items
  @numbered = numbered
  super(**attrs)
end

Instance Method Details

#view_templateObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rbui/typography/typography_list.rb', line 11

def view_template(&)
  if @items.empty?
    list(**attrs, &)
  else
    list(**attrs) do
      @items.each do |item|
        TypographyListItem { item }
      end
    end
  end
end