Class: Playbook::PbIcon::Icon
- Inherits:
-
KitBase
- Object
- ViewComponent::Base
- KitBase
- Playbook::PbIcon::Icon
show all
- Defined in:
- app/pb_kits/playbook/pb_icon/icon.rb
Instance Method Summary
collapse
Methods inherited from KitBase
#object
included
Methods included from ZIndex
included
Methods included from Spacing
included, #max_width_options, #max_width_props, #max_width_values, #spacing_options, #spacing_props, #spacing_values
Methods included from Classnames
#generate_classname, #generate_classname_without_spacing, included
#initialize, #prop
#pb_rails
#pb_form_with
Instance Method Details
#classname ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'app/pb_kits/playbook/pb_icon/icon.rb', line 36
def classname
generate_classname(
"pb_icon_kit",
"far",
icon_class,
border_class,
fixed_width_class,
flip_class,
inverse_class,
list_item_class,
pull_class,
pulse_class,
rotation_class,
size_class,
spin_class,
separator: " "
)
end
|
#custom_icon_classname ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'app/pb_kits/playbook/pb_icon/icon.rb', line 55
def custom_icon_classname
generate_classname(
"pb_icon_kit",
border_class,
fixed_width_class,
flip_class,
inverse_class,
list_item_class,
pull_class,
pulse_class,
rotation_class,
size_class,
spin_class,
separator: " "
)
end
|
#render_svg(path) ⇒ Object
72
73
74
75
76
77
78
79
80
81
|
# File 'app/pb_kits/playbook/pb_icon/icon.rb', line 72
def render_svg(path)
if File.extname(path) == ".svg"
doc = Nokogiri::XML(open(path)) svg = doc.at_css "svg"
svg["class"] = "pb_custom_icon " + object.custom_icon_classname
raw doc
else
raise("Custom icon must be an svg. Please check your path and file type.")
end
end
|