Skip to content

Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. 🔥💬

1.5 KB
Raw Blame
<%# A Settings or Monitor page. The sidebar carries the section's links from lg up; below that a picker opens them in a sheet. %>
<%# locals: (title:, description: nil, icon: nil) -%>
<%
  section = section_nav
  # A page that is not in the list (a hidden or locked config) still gets a label for the picker.
  current = section[:items].find { |item| item[:active] } || { label: title, icon: icon }
%>

<div class="space-y-6 pt-6 lg:pt-8">
  <button type="button" class="rounded-xl border border-n-weak bg-n-solid-1 flex min-h-11 w-full items-center gap-2.5 px-3 text-start text-body-main hover:bg-n-alpha-2 lg:hidden" data-dialog-open="section-nav" aria-haspopup="dialog">
    <span class="<%= current[:icon] %> size-4 shrink-0"></span>
    <span class="text-n-slate-11"><%= section[:label] %></span>
    <span class="min-w-0 flex-1 truncate font-medium text-n-slate-12"><%= current[:label] %></span>
    <span class="i-lucide-chevrons-up-down size-4 shrink-0 text-n-slate-10"></span>
  </button>

  <header class="flex min-w-0 items-center gap-3">
    <% if icon %>
      <%= render "icon_tile", icon: icon, extra: "size-10 rounded-xl" %>
    <% end %>
    <div class="min-w-0">
      <h1 class="text-heading-1 text-n-slate-12"><%= title %></h1>
      <% if description %>
        <p class="mt-1 max-w-2xl text-body-main text-n-slate-11"><%= description %></p>
      <% end %>
    </div>
  </header>

  <%= yield %>
</div>

<%= render "sheet", id: "section-nav", title: section[:label] do %>
  <%= render "section_links", items: section[:items] %>
<% end %>