Sha256: cf1b7fef034cb2755319e92327b443c21bd6e4be30c748448576ff5906fce863

Contents?: true

Size: 1.56 KB

Versions: 10

Compression:

Stored size: 1.56 KB

Contents

<% if comp
     leading_icon = comp.icons.select {|i| i.position.select{|p| eq(p, :left)}.any?}.first
     trailing_icon = comp.icons.select {|i| i.position.select{|p| eq(p, :right)}.any?}.first
     first_chip = !eq(components[index-1]&.type, :chip)
     last_chip = !eq(components[index+1]&.type, :chip)

     child_events = (leading_icon&.events || trailing_icon&.events || comp.text&.events||[]).any?
%>
  <% if first_chip %>
    <div class="mdc-chip-set">
  <% end %>
  <div id="<%= comp.id %>"
       class="mdc-chip
              <%= color_classname(comp) %>"
       style = "<%= color_style(comp, 'background-') %>"
       tabindex="0"
       <%= erb(:"components/event", locals: {events: comp.events,
                                             parent_id: comp.id}) unless child_events %>>
    <%= erb(:"components/icon", :locals => {comp: leading_icon,
                                            class_name: 'mdc-chip__icon mdc-chip__icon--leading',
                                            events: child_events ? (leading_icon&.events || comp.events) : nil}) %>
    <%= erb :"components/typography", :locals => {comp: comp.text, type: 'chip-text', class_name: 'mdc-chip__text'} %>
    <%= erb(:"components/icon", locals: {comp: trailing_icon,
                                         class_name: 'mdc-chip__icon mdc-chip__icon--trailing',
                                         events: trailing_icon&.events || comp.events }) %>
  </div>
  <% if last_chip %>
    </div>
  <% end %>
  <%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %>
<% end %>

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
voom-presenters-0.1.9 views/mdc/components/chip.erb
voom-presenters-0.1.8 views/mdc/components/chip.erb
voom-presenters-0.1.7 views/mdc/components/chip.erb
voom-presenters-0.1.6 views/mdc/components/chip.erb
voom-presenters-0.1.5 views/mdc/components/chip.erb
voom-presenters-0.1.4 views/mdc/components/chip.erb
voom-presenters-0.1.3 views/mdc/components/chip.erb
voom-presenters-0.1.2 views/mdc/components/chip.erb
voom-presenters-0.1.1 views/mdc/components/chip.erb
voom-presenters-0.1.0 views/mdc/components/chip.erb