Sha256: 4ed65c4fe321502b7eb157df6aeb0090c6c76448ee619204a7ec7179d5adb5fb

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

<nav id="nav"
  class="select-none"
  x-data="{empty: false}"
  @filtered="$nextTick(() => {
    setTimeout(() => {empty = !$el.querySelectorAll('#nav > ul > li:not(.hidden)').length}, 0)
  })"
  @document:updated.document="$el.innerHTML = $event.detail.doc.getElementById('nav').innerHTML">
  <% if @nav.items.any? %>
    <ul>
      <% @nav.items.each do |item| %>
        <% if item.type == :collection %>
          <%= render "partials/nav/collection", collection: item %>
        <% else %>
          <%= render "partials/nav/preview", preview: item %>
        <% end %>
      <% end %>
    </ul>
    <div class="p-4 text-center" x-show="empty" x-cloak>
      <em class="text-gray-400">No matching previews found.</em>
    </div>
  <% else %>
    <div class="p-4">
      <h4 class="text-gray-500 mb-1">No previews found.</h4>
      <p class="text-gray-400 text-xs">Have you set your <a class="underline" href="https://viewcomponent.org/api.html#preview_paths">preview paths</a> config correctly?</p>
    </div>
  <% end %>
</nav>

Version data entries

5 entries across 5 versions & 1 rubygems

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