[backend/razor] Add instance icon and banner to home page
This commit is contained in:
parent
8c50211efb
commit
93df8755ac
3 changed files with 40 additions and 4 deletions
|
@ -3,8 +3,6 @@
|
|||
@* ReSharper disable Html.PathError *@
|
||||
@{
|
||||
ViewData["title"] = $"Home - {Model.InstanceName}";
|
||||
|
||||
//TODO: logo / banner & favicon
|
||||
}
|
||||
|
||||
@section head
|
||||
|
@ -16,11 +14,23 @@
|
|||
}
|
||||
|
||||
<div class="header">
|
||||
<h1>@Model.InstanceName</h1>
|
||||
<span>
|
||||
@if (Model.IconUrl != null)
|
||||
{
|
||||
<img class="icon" src="@Model.IconUrl" alt="icon"/>
|
||||
}
|
||||
<h1>@Model.InstanceName</h1>
|
||||
</span>
|
||||
<div class="wordmark">
|
||||
<img src="~/_content/Iceshrimp.Assets.Branding/welcome-logo.svg" alt="Iceshrimp"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (Model.BannerUrl != null)
|
||||
{
|
||||
<img class="banner" src="@Model.BannerUrl" alt="banner"/>
|
||||
}
|
||||
|
||||
<p>@Model.InstanceDescription</p>
|
||||
|
||||
@if (Model.Rules.Count != 0)
|
||||
|
|
|
@ -13,6 +13,8 @@ public class IndexModel(MetaService meta, InstanceService instance, IOptionsSnap
|
|||
public string? ContactEmail;
|
||||
public string InstanceDescription = null!;
|
||||
public string InstanceName = null!;
|
||||
public string? IconUrl;
|
||||
public string? BannerUrl;
|
||||
public List<Rule> Rules = [];
|
||||
|
||||
public async Task<IActionResult> OnGet()
|
||||
|
@ -32,6 +34,8 @@ public class IndexModel(MetaService meta, InstanceService instance, IOptionsSnap
|
|||
instanceDescription ?? "This Iceshrimp.NET instance does not appear to have a description";
|
||||
ContactEmail = contactEmail;
|
||||
|
||||
(IconUrl, BannerUrl) = await instance.GetInstanceImageAsync();
|
||||
|
||||
Rules = await instance.GetRulesAsync();
|
||||
|
||||
return Page();
|
||||
|
|
|
@ -8,12 +8,34 @@
|
|||
gap: 0 12px;
|
||||
}
|
||||
|
||||
.header>h1 {
|
||||
.header span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.header .icon {
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
border-radius: 8px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.header>.wordmark {
|
||||
width: 160px;
|
||||
line-height: 0;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.banner {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
object-fit: cover;
|
||||
aspect-ratio: 21/9;
|
||||
border-radius: 1rem;
|
||||
}
|
Loading…
Add table
Reference in a new issue