namespace Htmx.ApiDemo.Templates.Components;
///
/// shadcn-style Breadcrumb navigation.
/// Pass items as (Label, Href) tuples — empty Href renders a non-linked span.
/// The last item is always rendered as the current page (non-linked, foreground colour).
///
public sealed class Breadcrumb : BreadcrumbBase
{
private const string ChevronSvg =
"""""";
private readonly byte[] _itemsData;
public Breadcrumb(IEnumerable<(string Label, string Href)> items)
{
var list = items.ToList();
var sb = new System.Text.StringBuilder();
for (int i = 0; i < list.Count; i++)
{
var (label, href) = list[i];
bool isLast = i == list.Count - 1;
sb.Append("""
""");
if (isLast || string.IsNullOrEmpty(href))
sb.Append($"""{label}""");
else
sb.Append($"""{label}""");
if (!isLast)
sb.Append($"""{ChevronSvg}""");
sb.Append("