Class: BulmaX::Icon
Constant Summary
BaseComponent::BLANK_VALUES, BaseComponent::BOOLEAN, BaseComponent::COLORS, BaseComponent::COLOR_MODIFIER, BaseComponent::COLOR_PALETTE, BaseComponent::MODIFIERS, BaseComponent::MODIFIERS_DECLINED, BaseComponent::MODIFIERS_PALETTE
Shared::SpacingOptions::VALID_SPACING_KEYS, Shared::SpacingOptions::VALID_SPACING_VALUES
Instance Method Summary
collapse
#after_template, #attributes, #base_attributes, #base_classes, #before_template, #classes, #compact_blank, #css, #initialize, #render_root
#aria_attributes, included
#global_attributes, #global_classes, included
#data_attributes, included
#flex_classes, included
included, #spacing_classes
included, #text_classes
included
Instance Method Details
#icon ⇒ Object
39
40
41
42
|
# File 'lib/bulma_x/icon.rb', line 39
def icon
raise NotImplementedError,
'You must implement the icon method, using FontAwesome, Material Icons, or another icon library.'
end
|
#icon_alignment_class ⇒ Object
60
61
62
63
64
|
# File 'lib/bulma_x/icon.rb', line 60
def icon_alignment_class
return unless @icon_alignment == :right
'is-flex-direction-row-reverse'
end
|
#icon_container_classes ⇒ Object
44
45
46
47
48
49
|
# File 'lib/bulma_x/icon.rb', line 44
def icon_container_classes
%w[
icon-text
is-align-items-center
]
end
|
#icon_template ⇒ Object
33
34
35
36
37
|
# File 'lib/bulma_x/icon.rb', line 33
def icon_template(&)
render_root do
icon
end
end
|
#icon_text_template ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/bulma_x/icon.rb', line 21
def icon_text_template(&)
slot(:icon_container) do
if @icon_alignment == :right
span(&)
render_root { icon }
else
render_root { icon }
span(&)
end
end
end
|
#root_classes ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'lib/bulma_x/icon.rb', line 51
def root_classes
super +
[
'icon',
@control_alignment && "is-#{@control_alignment}",
@size && "is-#{@size}"
]
end
|
#view_template ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/bulma_x/icon.rb', line 13
def view_template(&)
if block_given?
icon_text_template(&)
else
icon_template(&)
end
end
|