2024-01-23 17:55:34 +08:00
|
|
|
@page "/essays/{Filename}"
|
|
|
|
@using YaeBlog.Core.Models
|
|
|
|
@using YaeBlog.Core.Services
|
|
|
|
|
|
|
|
@inject BlogOptions BlogOptionsInstance
|
|
|
|
@inject EssayContentService EssayContent
|
|
|
|
@inject NavigationManager NavigationInstance
|
|
|
|
|
2024-01-27 22:46:15 +08:00
|
|
|
<PageTitle>
|
|
|
|
@(_essay!.Title)
|
|
|
|
</PageTitle>
|
|
|
|
|
2024-01-23 17:55:34 +08:00
|
|
|
<div style="height: 100%">
|
|
|
|
<div class="essay-background" style="background-image: url('@(BlogOptionsInstance.EssayImage)')">
|
|
|
|
<div class="essay-title">
|
2024-01-24 20:53:41 +08:00
|
|
|
<FluentStack Orientation="@Orientation.Vertical"
|
|
|
|
HorizontalAlignment="@HorizontalAlignment.Center">
|
|
|
|
<FluentLabel Typo="@Typography.H1" Style="color: white">
|
|
|
|
@(_essay!.Title)
|
|
|
|
</FluentLabel>
|
|
|
|
<div class="essay-subtitle">
|
|
|
|
<FluentIcon Value="@(new Icons.Regular.Size16.Calendar())"
|
|
|
|
Color="@Color.Fill"/>
|
|
|
|
<FluentLabel Typo="@Typography.H5" Style="color: white; margin-left: 0.25rem">
|
|
|
|
@(_essay!.PublishTime.ToString("yyyy年MM月dd日"))
|
|
|
|
</FluentLabel>
|
|
|
|
</div>
|
|
|
|
<div class="essay-subtitle">
|
|
|
|
<FluentIcon Value="@(new Icons.Regular.Size16.DataBarVerticalAscending())"
|
|
|
|
Color="@Color.Fill"/>
|
|
|
|
<FluentLabel Typo="@Typography.H5" Style="color: white; margin-left: 0.25rem">
|
|
|
|
@(_essay!.WordCount)字
|
|
|
|
</FluentLabel>
|
|
|
|
</div>
|
|
|
|
</FluentStack>
|
2024-01-23 17:55:34 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="height: 2rem"></div>
|
|
|
|
|
|
|
|
<div style="margin: 0 8% 0 8%">
|
|
|
|
<FluentGrid>
|
|
|
|
<FluentGridItem xs="12" sm="12" md="8" lg="8">
|
2024-02-15 21:20:32 +08:00
|
|
|
<FluentCard Style="margin: 2rem 0">
|
2024-01-23 17:55:34 +08:00
|
|
|
<div class="essay-content">
|
|
|
|
@((MarkupString)_essay!.HtmlContent)
|
|
|
|
</div>
|
|
|
|
</FluentCard>
|
|
|
|
</FluentGridItem>
|
|
|
|
|
|
|
|
<FluentGridItem xs="12" sm="12" md="4" lg="4">
|
2024-02-15 21:20:32 +08:00
|
|
|
<FluentStack Orientation="@Orientation.Vertical">
|
|
|
|
<AuthorInformation/>
|
2024-01-23 17:55:34 +08:00
|
|
|
|
2024-02-15 21:20:32 +08:00
|
|
|
<Announcement/>
|
|
|
|
</FluentStack>
|
2024-01-23 17:55:34 +08:00
|
|
|
</FluentGridItem>
|
|
|
|
</FluentGrid>
|
|
|
|
</div>
|
2024-01-25 23:05:44 +08:00
|
|
|
|
|
|
|
<BlogFooter/>
|
2024-01-23 17:55:34 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
@code {
|
2024-01-24 20:53:41 +08:00
|
|
|
[Parameter] public string? Filename { get; set; }
|
2024-01-23 17:55:34 +08:00
|
|
|
|
|
|
|
private BlogEssay? _essay;
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(Filename))
|
|
|
|
{
|
|
|
|
NavigationInstance.NavigateTo("NotFound");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!EssayContent.TryGet(Filename, out _essay))
|
|
|
|
{
|
|
|
|
NavigationInstance.NavigateTo("NotFound");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|