From 4a97483b09a2403b07a84854333ffad216d7994d Mon Sep 17 00:00:00 2001 From: jackfiled Date: Thu, 25 Jan 2024 23:05:44 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E5=AD=98=E6=A1=A3=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YaeBlog.Theme.FluentUI/Pages/Archives.razor | 74 +++++++++++++++++++ .../Pages/Archives.razor.css | 24 ++++++ YaeBlog.Theme.FluentUI/Pages/Essay.razor | 2 + 3 files changed, 100 insertions(+) create mode 100644 YaeBlog.Theme.FluentUI/Pages/Archives.razor create mode 100644 YaeBlog.Theme.FluentUI/Pages/Archives.razor.css diff --git a/YaeBlog.Theme.FluentUI/Pages/Archives.razor b/YaeBlog.Theme.FluentUI/Pages/Archives.razor new file mode 100644 index 0000000..e2f34eb --- /dev/null +++ b/YaeBlog.Theme.FluentUI/Pages/Archives.razor @@ -0,0 +1,74 @@ +@page "/archives" +@using YaeBlog.Core.Models +@using YaeBlog.Core.Services + +@inject BlogOptions BlogOptionsInstance +@inject EssayContentService EssayContentInstance + +
+
+
+ + + 存 档 + + +
+
+ +
+ +
+ +
+ + 共计@(EssayContentInstance.Count)篇文章 + + + @foreach (IGrouping> group in _essays) + { + + @(group.Key.ToString("yyyy年")) + + + + } +
+
+
+ + +
+ +@code { + private readonly List>> _essays = []; + + protected override void OnInitialized() + { + IEnumerable>> essays = + from essay in EssayContentInstance.Essays + orderby essay.Value.PublishTime descending + group essay by new DateTime(essay.Value.PublishTime.Year, 1, 1); + + _essays.AddRange(essays); + } + +} diff --git a/YaeBlog.Theme.FluentUI/Pages/Archives.razor.css b/YaeBlog.Theme.FluentUI/Pages/Archives.razor.css new file mode 100644 index 0000000..8746f42 --- /dev/null +++ b/YaeBlog.Theme.FluentUI/Pages/Archives.razor.css @@ -0,0 +1,24 @@ +.archive-background { + position: relative; + height: 80%; + overflow: hidden; + background-repeat: no-repeat; + background-size: cover; +} + +.archive-title { + top: 43%; + position: absolute; + width: 100%; +} + +.archive-item { + padding: 0.5rem 0.5rem 0.5rem 0.5rem; + margin: 0.5rem 0 0.5rem 0; + border-radius: 4px; +} + +.archive-item:hover { + background-color: rgba(169, 169, 169, 0.22); +} + diff --git a/YaeBlog.Theme.FluentUI/Pages/Essay.razor b/YaeBlog.Theme.FluentUI/Pages/Essay.razor index 9df0164..63a800d 100644 --- a/YaeBlog.Theme.FluentUI/Pages/Essay.razor +++ b/YaeBlog.Theme.FluentUI/Pages/Essay.razor @@ -49,6 +49,8 @@ + + @code {