package components import ( "strings" "github.com/charmbracelet/lipgloss" ) // BreadcrumbItem represents a single item in the breadcrumb trail type BreadcrumbItem struct { Label string ID string // Optional identifier for the screen } // BreadcrumbStyle defines the appearance of breadcrumbs var ( breadcrumbStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("241")). MarginBottom(1) breadcrumbSeparatorStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("240")) breadcrumbItemStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("241")) breadcrumbCurrentStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("62")). Bold(true) ) // RenderBreadcrumb renders a breadcrumb trail from a slice of items func RenderBreadcrumb(items []BreadcrumbItem) string { if len(items) == 0 { return "" } var parts []string for i, item := range items { var text string if i == len(items)-1 { // Last item - current page text = breadcrumbCurrentStyle.Render(item.Label) } else { // Non-last items - clickable/previous pages text = breadcrumbItemStyle.Render(item.Label) } parts = append(parts, text) // Add separator if not last item if i < len(items)-1 { parts = append(parts, breadcrumbSeparatorStyle.Render(" > ")) } } return breadcrumbStyle.Render(strings.Join(parts, "")) }