initforthe/spina-blog

View on GitHub
app/views/spina/admin/hooks/blog/_primary_navigation.html.erb

Summary

Maintainability
Test Coverage
<%= render Spina::MainNavigation::SubNavComponent.new(:blog) do |nav| %>
  <% nav.with_icon do %>
    <%= heroicon('pencil', style: :solid, class: 'w-8 h-8 text-white md:mr-3') %>
    
    <div class="text-white font-semibold hidden md:block transform -translate-x-2 ease-in-out duration-300 absolute md:relative opacity-0 transition-all" data-navigation-target="label">
      <%=t 'spina.blog.title' %>
    </div>
  <% end %>
  
  <% nav.with_links do %>
    <%= render Spina::MainNavigation::LinkComponent.new(t('spina.blog.posts.title'), admin_blog_posts_path, active: request.path.start_with?("/#{Spina.config.backend_path}/blog/posts")) %>
    <%= render Spina::MainNavigation::LinkComponent.new(t('spina.blog.categories.title'), admin_blog_categories_path, active: request.path.start_with?("/#{Spina.config.backend_path}/blog/categories")) %>
  <% end %>
<% end %>