@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
@using Dynamicweb.Frontend

@{
	string title = "Swift";
	if (Model.Item.TryGetString("LogoName", out string logoName))
	{
		title = logoName;
	}

	string homePageLink = "/";
	if (Model.Item.TryGetLink("Link", out LinkViewModel link)) {
		homePageLink = link.Url;
	}
}

<div class="d-flex position-relative">
	@if (Model.Item.TryGetImageFile("Image", out ImageFileViewModel image)) {	
		if (Model.Item.TryGetString("LogoWidth", out string logoWidth)) {
			logoWidth = $"width:{logoWidth}px";
		}
		if (image.IsSvg()) {
			<figure class="icon-auto m-0" style="@logoWidth">
				@ReadFile(image.Path)
			</figure>
		}
		else 
		{
			<figure class="m-0">
				<img src="@image.Path" alt="@image.Path" style="@logoWidth">
			</figure>
		}
	}
	else 
	{
		<span class="fs-4">@title</span>
	}
	<a href="@homePageLink" class="stretched-link" title="@title"></a>
</div>
