Class: NfgUi::Components::Patterns::Carousel

Inherits:
Bootstrap::Components::Carousel show all
Includes:
Utilities::Describable, Utilities::Renderable, Utilities::Traitable
Defined in:
lib/nfg_ui/components/patterns/carousel.rb

Overview

Carousel doesn’t have any customizations unique to the design system yet As such, the NFG UI carousel is simply a bootstrap carousel behind the scenes. Traits will eventually be connected here.

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::Renderable

#render_if, #render_unless

Methods included from Utilities::Describable

#data, #describe

Methods included from Utilities::Traitable

#traits, #utility_initialize

Methods inherited from Bootstrap::Components::Carousel

#component_family, #controls, #data, #indicators

Methods inherited from Bootstrap::Components::Base

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

Constructor Details

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

Instance Method Details

#renderObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/nfg_ui/components/patterns/carousel.rb', line 14

def render
  (:div, html_options) do
    (:div, class: carousel_inner_css_classes) do
      concat((block_given? ? yield : body))
      if controls
        concat(NfgUi::Components::Elements::CarouselControl.new({ control: :next, carousel: "##{id}" }, view_context).render)
        concat(NfgUi::Components::Elements::CarouselControl.new({ control: :prev, carousel: "##{id}" }, view_context).render)
      end
      if indicators > 0
        concat(NfgUi::Components::Elements::CarouselIndicators.new({ count: indicators, carousel: "##{id}" }, view_context).render)
      end
    end
  end
end