The file is a Razor component definition for a modal dialog window. It controls the visibility of the dialog, displays a title, renders custom content and action buttons, and handles dismissal when the background scrim is clicked.
@namespace CitySim.Punchboard
@using Sandbox.UI
@inherits Panel
@if ( Open )
{
<div class="pb-scrim" onclick=@(() => Dismissed?.Invoke())></div>
<PbPanel Title=@(GameText.Plain(Title)) Kind=@(PbPanelKind.Raised)>
<ChildContent>
@ChildContent
@if ( Actions != null )
{
<div class="pb-modal-actions">@Actions</div>
}
</ChildContent>
</PbPanel>
}
@code
{
/// <summary>Content placed inside the component.</summary>
[Parameter] public new RenderFragment ChildContent { get; set; }
[Parameter] public bool Open { get; set; }
[Parameter] public string Title { get; set; }
/// <summary>Buttons shown at the bottom right, primary last.</summary>
[Parameter] public RenderFragment Actions { get; set; }
/// <summary>Called when the scrim behind the dialog is clicked.</summary>
[Parameter] public Action Dismissed { get; set; }
protected override int BuildHash() => HashCode.Combine(GameText.LanguageCode, HashCode.Combine( Open, Title ));
}