[frontend/components] Add HeadTitle component
This commit is contained in:
parent
df244a3c20
commit
c91b3013c7
1 changed files with 24 additions and 0 deletions
24
Iceshrimp.Frontend/Components/HeadTitle.razor
Normal file
24
Iceshrimp.Frontend/Components/HeadTitle.razor
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
@using Iceshrimp.Frontend.Core.Services
|
||||||
|
@inject MetadataService Metadata;
|
||||||
|
|
||||||
|
@if (string.IsNullOrWhiteSpace(Text))
|
||||||
|
{
|
||||||
|
<PageTitle>@InstanceName</PageTitle>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<PageTitle>@Text | @InstanceName</PageTitle>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter] public string? Text { get; set; }
|
||||||
|
private string InstanceName { get; set; } = "Iceshrimp.NET";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
var metadata = await Metadata.Instance.Value;
|
||||||
|
|
||||||
|
if (metadata.Name != null)
|
||||||
|
InstanceName = metadata.Name;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue