using Connected.Utilities;
using Microsoft.AspNetCore.Components;

namespace Connected.Components;
public partial class Link
{
    [Parameter, EditorRequired]
    public string Url { get; set; } = string.Empty;

    [Parameter, EditorRequired]
    public string Text { get; set; } = string.Empty;

    [Parameter, EditorRequired]
    public string Target { get; set; } = "_self";

    [Parameter]
    public string Class { get; set; } = string.Empty;

    private string LinkClassList
    {
        get
        {
            return new CssBuilder()
                .AddClass(Class)
                .Build();
        }
    }

    [Parameter]
    public string Style { get; set; } = string.Empty;

    private string LinkStyleList
    {
        get
        {
            return new StyleBuilder()
                .AddStyle(Style)
                .Build();
        }
    }

    protected override async Task OnParametersSetAsync()
    {
        if (string.IsNullOrEmpty(Text)) Text = Url;
        await base.OnParametersSetAsync();
    }
}


