Created more components
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
namespace Htmx.ApiDemo.Templates.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Fixed viewport container for toast notifications.
|
||||
/// Place once in the page (or layout). Toasts appear via window.showToast() from components.js.
|
||||
/// </summary>
|
||||
public sealed class ToastViewport : ToastViewportBase
|
||||
{
|
||||
private readonly byte[] _idData;
|
||||
private readonly byte[] _toastsData;
|
||||
|
||||
public ToastViewport(string id = "toast-viewport")
|
||||
{
|
||||
_idData = id.ToUtf8Bytes();
|
||||
_toastsData = [];
|
||||
}
|
||||
|
||||
protected override void RenderId(HtmxRenderContext ctx) => ctx.Writer.WriteUtf8(_idData);
|
||||
protected override void RenderToasts(HtmxRenderContext ctx) => ctx.Writer.WriteUtf8(_toastsData);
|
||||
}
|
||||
Reference in New Issue
Block a user