| | | 1 | | @* DetailPageHeader.razor - Reusable header for entity detail pages *@ |
| | | 2 | | @* Includes breadcrumbs, icon + editable title, and rune divider *@ |
| | | 3 | | |
| | | 4 | | <!-- Breadcrumbs --> |
| | | 5 | | <ChroniclsBreadcrumbs Items="Breadcrumbs" Class="mb-2" /> |
| | | 6 | | |
| | | 7 | | <!-- Icon and Title --> |
| | | 8 | | <div class="d-flex align-center mb-3"> |
| | | 9 | | <MudIcon Icon="@Icon" |
| | | 10 | | Size="Size.Large" |
| | | 11 | | Class="mr-3 generic-container-icon" |
| | | 12 | | Style="color: var(--chronicis-beige-gold); font-size: 2.5rem;" /> |
| | | 13 | | <MudTextField @bind-Value="Title" |
| | | 14 | | @bind-Value:after="OnTitleChangedInternal" |
| | | 15 | | Variant="Variant.Text" |
| | | 16 | | Placeholder="@Placeholder" |
| | | 17 | | Class="chronicis-article-title flex-grow-1" |
| | | 18 | | Style="font-size: 2rem; font-family: var(--chronicis-font-heading);" |
| | | 19 | | Immediate="true" |
| | | 20 | | @onkeydown="OnKeyDownInternal" |
| | | 21 | | Underline="false" /> |
| | | 22 | | </div> |
| | | 23 | | |
| | | 24 | | <!-- Divider --> |
| | | 25 | | <div class="chronicis-rune-divider mb-4"></div> |
| | | 26 | | |
| | | 27 | | @code { |
| | | 28 | | /// <summary> |
| | | 29 | | /// The breadcrumb items to display. |
| | | 30 | | /// </summary> |
| | | 31 | | [Parameter] |
| | 33 | 32 | | public List<BreadcrumbItem> Breadcrumbs { get; set; } = new(); |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// The Material icon to display (e.g., Icons.Material.Filled.Public). |
| | | 36 | | /// </summary> |
| | | 37 | | [Parameter] |
| | 36 | 38 | | public string Icon { get; set; } = Icons.Material.Filled.Description; |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// The current title value (two-way bound). |
| | | 42 | | /// </summary> |
| | | 43 | | [Parameter] |
| | 84 | 44 | | public string Title { get; set; } = string.Empty; |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Callback when title changes. |
| | | 48 | | /// </summary> |
| | | 49 | | [Parameter] |
| | 3 | 50 | | public EventCallback<string> TitleChanged { get; set; } |
| | | 51 | | |
| | | 52 | | /// <summary> |
| | | 53 | | /// Placeholder text for the title field. |
| | | 54 | | /// </summary> |
| | | 55 | | [Parameter] |
| | 33 | 56 | | public string Placeholder { get; set; } = "Name"; |
| | | 57 | | |
| | | 58 | | /// <summary> |
| | | 59 | | /// Callback when the title content changes (for marking unsaved changes). |
| | | 60 | | /// </summary> |
| | | 61 | | [Parameter] |
| | 3 | 62 | | public EventCallback OnTitleEdited { get; set; } |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// Callback when Enter key is pressed (for triggering save). |
| | | 66 | | /// </summary> |
| | | 67 | | [Parameter] |
| | 0 | 68 | | public EventCallback OnEnterPressed { get; set; } |
| | | 69 | | |
| | | 70 | | private async Task OnTitleChangedInternal() |
| | | 71 | | { |
| | 2 | 72 | | await TitleChanged.InvokeAsync(Title); |
| | 2 | 73 | | await OnTitleEdited.InvokeAsync(); |
| | 2 | 74 | | } |
| | | 75 | | |
| | | 76 | | private async Task OnKeyDownInternal(KeyboardEventArgs e) |
| | | 77 | | { |
| | 0 | 78 | | if (e.Key == "Enter") |
| | | 79 | | { |
| | 0 | 80 | | await OnEnterPressed.InvokeAsync(); |
| | | 81 | | } |
| | 0 | 82 | | } |
| | | 83 | | } |