25 lines
886 B
C#
25 lines
886 B
C#
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);
|
|
}
|