Created more components
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
namespace Htmx.ApiDemo.Templates.Components;
|
||||
|
||||
/// <summary>
|
||||
/// shadcn-style Separator component.
|
||||
/// Orientation: horizontal | vertical
|
||||
/// </summary>
|
||||
public sealed class Separator : SeparatorBase
|
||||
{
|
||||
private readonly byte[] _classesData;
|
||||
private readonly byte[] _orientationData;
|
||||
|
||||
public Separator(string orientation = "horizontal", string extraClasses = "")
|
||||
{
|
||||
var cls = orientation == "vertical"
|
||||
? $"inline-block h-full w-px bg-border {extraClasses}"
|
||||
: $"block h-px w-full bg-border {extraClasses}";
|
||||
|
||||
_classesData = cls.Trim().ToUtf8Bytes();
|
||||
_orientationData = orientation.ToUtf8Bytes();
|
||||
}
|
||||
|
||||
protected override void RenderClasses(HtmxRenderContext ctx) => ctx.Writer.WriteUtf8(_classesData);
|
||||
protected override void RenderOrientation(HtmxRenderContext ctx) => ctx.Writer.WriteUtf8(_orientationData);
|
||||
}
|
||||
Reference in New Issue
Block a user