@using Wave.Data
@using System.Net
@using System.Web
@using Wave.Utilities

<a href="@Link" target="_top" @attributes="AdditionalAttributes">
	@ChildContent
</a>

@code {
	[Parameter]
	public required Article Article { get; set; }
	[Parameter]
	public RenderFragment? ChildContent { get; set; }

	private string TitleEncoded => Uri.EscapeDataString(Article.Title.ToLowerInvariant()).Replace("-", "+").Replace("%20", "-");
	private string Link => ArticleUtilities.GenerateArticleLink(Article, null);

	[Parameter(CaptureUnmatchedValues = true)]
	public Dictionary<string, object>? AdditionalAttributes { get; set; }
}
