class NfgUi::Components::Patterns::Slats

Main slats

Public Instance Methods

component_family() click to toggle source
# File lib/nfg_ui/components/patterns/slats.rb, line 13
def component_family
  :slats
end
nowrap() click to toggle source

When :nowrap is true, the slat-item columns will not break into rows regardless of responsive page width

When false / not present slat item columns will break down into rows as expected in conventional responsivel webpage design.

# File lib/nfg_ui/components/patterns/slats.rb, line 24
def nowrap
  options.fetch(:nowrap, false)
end
slat_actions() click to toggle source

Determine whether or not to accomodate a specific SlatActions size configuration by default, when slat_actions is not set it should have a nil presence

Note: `nil` is different from the :none keyword

Options: :sm - account for a small SlatAction (icon only) :lg - account for a large SlatAction (Text & Icon) :none - Do not account for a SlatAction

Leaving `nil` for slat_actions will kick off default behavior for the Slats' SlatAction which is a combination of :lg (for large screen) and :sm for small screen (where the slat action flexes) across screen sizes hiding and showing its text

# File lib/nfg_ui/components/patterns/slats.rb, line 46
def slat_actions
  options[:slat_actions] || nil
end

Private Instance Methods

css_classes() click to toggle source
# File lib/nfg_ui/components/patterns/slats.rb, line 52
def css_classes
  [
    super,
    ("#{component_css_class}-nowrap" if nowrap),
    ("slat-actions-#{slat_actions}" if slat_actions_resized?)
  ].join(' ').squish
end
non_html_attribute_options() click to toggle source
# File lib/nfg_ui/components/patterns/slats.rb, line 67
def non_html_attribute_options
  super.push(:slat_actions, :nowrap)
end
slat_actions_resized?() click to toggle source

Only acceptable keywords are: :sm, :lg, and :none all other slat_action keywords are ignored

# File lib/nfg_ui/components/patterns/slats.rb, line 63
def slat_actions_resized?
  [:sm, :lg, :none].include?(slat_actions)
end