class Playbook::PbIcon::Icon
def border_class
def border_class border ? "fa-border" : nil end
def classname
def classname generate_classname( "pb_icon_kit", font_style_class, 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
def custom_icon_classname
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
def fixed_width_class
def fixed_width_class fixed_width ? "fa-fw" : nil end
def flip_class
def flip_class case flip when "horizontal" "fa-flip-horizontal" when "vertical" "fa-flip-vertical" when "both" "fa-flip-horizontal fa-flip-vertical" end end
def font_style_class
def font_style_class font_style ? font_style.to_s : "far" end
def icon_class
def icon_class icon ? "fa-#{icon}" : nil end
def inverse_class
def inverse_class inverse ? "fa-inverse" : nil end
def list_item_class
def list_item_class list_item ? "fa-li" : nil end
def pull_class
def pull_class pull ? "fa-pull-#{pull}" : nil end
def pulse_class
def pulse_class pulse ? "fa-pulse" : nil end
def render_svg(path)
def render_svg(path) if File.extname(path) == ".svg" doc = Nokogiri::XML(URI.open(path)) # rubocop:disable Security/Open 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
def rotation_class
def rotation_class rotation ? "fa-rotate-#{rotation}" : nil end
def size_class
def size_class size ? "fa-#{size}" : nil end
def spin_class
def spin_class spin ? "fa-spin" : nil end