Commit: 6c646c4
Parent: e2f0b7e

Build printing form

Mårten Åsberg committed on 2026-03-21 at 16:11
Receipt.Web/Components/Pages/Home.razor +33 -0
diff --git a/Receipt.Web/Components/Pages/Home.razor b/Receipt.Web/Components/Pages/Home.razor
index 88e6be8..5aa62c9 100644
@@ -1,5 +1,38 @@
@page "/"
@using Microsoft.Extensions.Logging
@inject ILogger<Home> logger
<PageTitle>Receipt Printer</PageTitle>
<h1>Print a receipt!</h1>
<EditForm Model="Model" OnValidSubmit="OnSubmit" FormName="PrintForm">
<p>
<label>
<span>Content:</span><br/>
<InputTextArea rows="10" cols="50" @bind-value="Model!.Content" />
</label>
</p>
<p>
<button type="submit">Print!</button>
</p>
</EditForm>
@code {
[SupplyParameterFromForm]
public PrintForm? Model { get; set; }
protected override void OnInitialized() => Model ??= new();
private async Task OnSubmit()
{
logger.LogInformation("Printing receipt with content: {Content}", Model!.Content);
Model = new();
}
public sealed record PrintForm
{
public string Content { get; set; } = string.Empty;
}
}