Sha256: cdd0b075e4693283709abcb007cd5a965036bf82cd88c3328c9e72c57c31c51f

Contents?: true

Size: 1.76 KB

Versions: 4

Compression:

Stored size: 1.76 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 %>
  <% if comp.menu %>
    <div class="mdc-menu-anchor">
  <% end %>

  <div id="<%= comp.id %>"
       class="mdc-chip
              <%= color_classname(comp) %>
              v-menu-click"
       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 comp.menu %>
    <%= erb :"components/list/menu", :locals => {:comp => comp.menu} %>
  </div>
  <%end%>
  <% if last_chip %>
    </div>
  <% end %>
  <%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %>
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
voom-presenters-0.1.13 views/mdc/components/chip.erb
voom-presenters-0.1.12 views/mdc/components/chip.erb
voom-presenters-0.1.11 views/mdc/components/chip.erb
voom-presenters-0.1.10 views/mdc/components/chip.erb