views/mdc/components/icon.erb
<% class_name = '' unless local_variables.include? :class_name
data = nil unless local_variables.include? :data
%>
<% if comp
parent_id = comp.event_parent_id unless locals.include? :parent_id
icon_name = comp.icon unless locals.include? :icon_name
events = comp.events unless locals.include? :events
position = comp.position||[] unless locals.include? :position
position_classes = position.map {|p| "v-icon-position-#{p}"}.join(' ')
class_name= "#{class_name} #{position_classes}"
if icon_name =~ /^(fa[srlb]\s)*fa-/
icon_class_name = "#{icon_name} v-icon__fa"
icon_class_name = "fas #{icon_class_name}" unless icon_class_name=~ /^(fas)|(fal)|(fab)/
icon = ''
else
icon_class_name = "material-icons"
icon = icon_name
end
size_class = "v-icon-size-#{comp.size}" unless locals.include? :size_class
%>
<i id="<%= comp.id %>"
class="<%= class_name %> <%= icon_class_name %> <%= size_class %>
<%= 'v-hidden' if comp.respond_to?(:hidden) && comp.hidden %>
<%= 'v-actionable' if comp.events %>
<%= color_classname(comp) %>"
<%= "data-#{data}" if data %>
style="<%= color_style(comp) %>"
<%= 'tabindex="0"' if comp.events %>
<%= erb :"components/event", :locals => {comp: comp, events: events, parent_id: parent_id} %>>
<%= icon %>
</i>
<%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %>
<%= expand_text(comp.text) if comp.respond_to?(:text) %>
<% end %>