app/views/lookbook/nav/_preview.html.erb in lookbook-0.3.0.beta.1 vs app/views/lookbook/nav/_preview.html.erb in lookbook-0.3.0.beta.2
- old
+ new
@@ -1,29 +1,11 @@
-<%= render "./nav/node", node: node do %>
- <% node.get_examples.each do |example| %>
- <% path = show_path example.path %>
- <li x-data="navLeaf" :class="{hidden}" x-init="matchers = <%= example.matchers.to_json %>; path = '<%= path %>'; setActive()" @popstate.window="setActive">
- <a href="<%= path %>"
- class="pr-3 py-[5px] flex items-center w-full group transition hover:bg-gray-200 hover:bg-opacity-50"
- style="<%= nav_padding_style(example.hierarchy_depth + 1) %>"
- :class="{'!bg-indigo-100':active}"
- @click.stop.prevent="navigate"
- >
- <div class="relative w-3.5 h-3.5 mr-1.5" :class="active ? 'text-gray-900' : 'text-indigo-500'">
- <svg class="feather flex-none group-hover:text-indigo-800 transition <% if example.type == :group %> absolute top-[-2px] left-[-2px] w-3 h-3<% else %>w-3.5 h-3.5<% end %>">
- <use xlink:href="/lookbook-assets/feather-sprite.svg#eye" />
- </svg>
- <% if example.type == :group %>
- <svg class="feather w-3 h-3 flex-none group-hover:text-indigo-800 transition absolute top-[4px] left-[4px]">
- <use xlink:href="/lookbook-assets/feather-sprite.svg#eye" />
- </svg>
- <% end %>
- </div>
- <div class="truncate whitespace-nowrap">
- <%= example.label %>
- </div>
- </a>
- </li>
+<% examples = node.get_examples %>
+<% if examples.many? %>
+ <%= render "./nav/node", node: node, path: show_path(examples.first.path) do %>
+ <% examples.each do |example| %>
+ <%= render "./nav/leaf", leaf: example, depth: example.hierarchy_depth + 1 %>
+ <% end %>
<% end %>
-<% end %>
-
-
+<% else %>
+ <% example = examples.first %>
+ <%= render "./nav/leaf", leaf: example, depth: example.hierarchy_depth, display: :node %>
+<% end %>
\ No newline at end of file