Sha256: 69bfbc5c4be4550c8d3efcbd83d4615db7c169aae86b5ce475294e126445a110

Contents?: true

Size: 1.86 KB

Versions: 5

Compression:

Stored size: 1.86 KB

Contents

<% examples = preview.get_examples %>
<li
  data-type="preview"
  x-data="{
    id: '<%= preview.lookbook_id %>',
    hidden: false,
    examples: <%= examples.map { |e| {id: e.id, matched: true, filter: e.filter_match_string} }.to_json %>,
    update(){
      this.examples.forEach(e => { e.matched = $store.nav.shouldDisplay(e.filter) });
      this.hidden = !this.examples.filter(e => e.matched).length;
      this.$dispatch('filtered');
    }
  }"
  x-init="
    $watch('$store.nav.filter', (value) => update()); update()"
  :class="{hidden}"
  <% if preview.hierarchy_depth == 1 %> class="py-1 border-b border-gray-300 cursor-pointer"<% end %>>
  <div @click="open[id] = !open[id]" style="<%= nav_padding_style(preview.hierarchy_depth) %>">
    <%= render "partials/nav/label", text: preview.label, icon: "layers", bold: true %>
  </div>
  <ul x-show="isOpen(id)" x-cloak>
    <% examples.each do |example| %>
      <li x-show="examples.find(e => e.id === '<%= example.id %>').matched">
        <a
          x-data="{path: '<%= show_path example.path %>'}"
          :href="path"
          class="pr-3 py-[3px] flex items-center w-full group transition hover:bg-gray-200 hover:bg-opacity-50"
          :class="{'!bg-indigo-100': location === path}"
          style="<%= nav_padding_style(example.hierarchy_depth + 1) %>"
          @click.stop.prevent="history.pushState({}, null, $event.currentTarget.href); $dispatch('popstate');"
        >
          <div :class="{'text-gray-900': location === path, 'text-indigo-500': location !== path}">
            <svg class="feather w-3.5 h-3.5 mr-1.5 flex-none group-hover:text-indigo-800 transition">
              <use xlink:href="#eye" />
            </svg>
          </div>
          <div class="truncate whitespace-nowrap">
            <%= example.label %>
          </div>
        </a>
      </li>
    <% end %>
  </ul>
</li>
<% if false %>
  
  
<% end %>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lookbook-0.2.4 app/views/lookbook/partials/nav/_preview.html.erb
lookbook-0.2.3 app/views/lookbook/partials/nav/_preview.html.erb
lookbook-0.2.2 app/views/lookbook/partials/nav/_preview.html.erb
lookbook-0.2.1 app/views/lookbook/partials/nav/_preview.html.erb
lookbook-0.2.0 app/views/lookbook/partials/nav/_preview.html.erb