Class: BulmaX::Figure

Inherits:
BaseComponent show all
Defined in:
lib/bulma_x/figure.rb

Constant Summary collapse

RATIOS =
%w[square 1x1 5x4 4x3 3x2 5x3 16x9 2x1 3x1 4x5 3x4 2x3 3x5 9x16 1x2 1x3].freeze

Constants inherited from BaseComponent

BaseComponent::BLANK_VALUES, BaseComponent::BOOLEAN, BaseComponent::COLORS, BaseComponent::COLOR_MODIFIER, BaseComponent::COLOR_PALETTE, BaseComponent::MODIFIERS, BaseComponent::MODIFIERS_DECLINED, BaseComponent::MODIFIERS_PALETTE

Constants included from Shared::SpacingOptions

Shared::SpacingOptions::VALID_SPACING_KEYS, Shared::SpacingOptions::VALID_SPACING_VALUES

Instance Method Summary collapse

Methods inherited from BaseComponent

#after_template, #attributes, #base_attributes, #base_classes, #before_template, #classes, #compact_blank, #css, #initialize, #render_root, #view_template

Methods included from Shared::AriaOptions

#aria_attributes, included

Methods included from Shared::GlobalOptions

#global_attributes, #global_classes, included

Methods included from Shared::DataOptions

#data_attributes, included

Methods included from Shared::FlexOptions

#flex_classes, included

Methods included from Shared::SpacingOptions

included, #spacing_classes

Methods included from Shared::TextOptions

included, #text_classes

Methods included from ComponentDsl

included

Constructor Details

This class inherits a constructor from BulmaX::BaseComponent

Instance Method Details

#normalize_ratio(ratio) ⇒ Object



21
22
23
24
25
# File 'lib/bulma_x/figure.rb', line 21

def normalize_ratio(ratio)
  return nil if ratio.nil?

  "is-#{ratio.split('x').join('by')}"
end

#root_classesObject



12
13
14
15
16
17
18
19
# File 'lib/bulma_x/figure.rb', line 12

def root_classes
  super +
    [
      'image',
      @size && "is-#{@size}x#{@size}",
      @ratio && normalize_ratio(@ratio)
    ]
end