Class: NfgUi::Components::Patterns::TileHeader

Inherits:
Base show all
Includes:
Bootstrap::Utilities::Collapsible, Utilities::Iconable, Utilities::Titleable
Defined in:
lib/nfg_ui/components/patterns/tile_header.rb

Overview

TileHeader doc coming soon

Constant Summary

Constants included from Traits

Traits::REGISTERED_TRAITS, Traits::TRAIT_MODULES

Instance Attribute Summary

Attributes inherited from Bootstrap::Components::Base

#body, #options, #view_context

Instance Method Summary collapse

Methods included from Utilities::Iconable

#icon

Methods included from Utilities::Titleable

#title

Methods included from Bootstrap::Utilities::Collapsible

#collapse, #collapsed, #collapsible

Methods included from Utilities::Traitable

#traits, #utility_initialize

Methods included from Utilities::Renderable

#render_if, #render_unless

Methods included from Utilities::Describable

#data, #describe

Methods inherited from Bootstrap::Components::Base

#data, #href, #html_options, #id, #initialize, #style

Constructor Details

This class inherits a constructor from NfgUi::Bootstrap::Components::Base

Instance Method Details

#component_familyObject



13
14
15
# File 'lib/nfg_ui/components/patterns/tile_header.rb', line 13

def component_family
  :tile
end

#renderObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/nfg_ui/components/patterns/tile_header.rb', line 17

def render
  super do
    if collapsible && title
      concat(NfgUi::Components::Elements::Button.new({ traits: [:link, :block], collapse: collapse, class: 'no-link-color p-0 m-0' }, view_context).render {
        (:div, class: 'row align-items-center') do
          concat((:div, class: 'col-10 text-left') {
            NfgUi::Components::Foundations::Typeface.new({ heading: title, icon: icon, class: 'h4' }, view_context).render
          })
          concat((:div, class: 'col-2 text-right') {
            NfgUi::Components::Foundations::Icon.new({ traits: ['caret-down fw'], tooltip: 'Show / hide additional information' }, view_context).render
          })
        end
      })
    elsif title
      concat(NfgUi::Components::Foundations::Typeface.new({ heading: title, icon: icon, class: 'h4' }, view_context).render)
    end

    concat((block_given? ? yield : body))
  end
end