[HTML] Cleanup templates slightly

This commit is contained in:
Tyrrrz 2021-06-22 14:16:08 +03:00
parent fd9d367bad
commit 2b0fa4213b
4 changed files with 17 additions and 13 deletions

View file

@ -1,8 +1,9 @@
@using System
@using System.Linq
@using System.Threading.Tasks
@namespace DiscordChatExporter.Core.Exporting.Writers.Html
@inherits MiniRazor.TemplateBase<DiscordChatExporter.Core.Exporting.Writers.Html.MessageGroupTemplateContext>
@inherits MiniRazor.TemplateBase<MessageGroupTemplateContext>
@{
string FormatDate(DateTimeOffset date) => Model.ExportContext.FormatDate(date);

View file

@ -1,5 +1,5 @@
@namespace DiscordChatExporter.Core.Exporting.Writers.Html
@inherits MiniRazor.TemplateBase<DiscordChatExporter.Core.Exporting.Writers.Html.PostambleTemplateContext>
@inherits MiniRazor.TemplateBase<PostambleTemplateContext>
</div>

View file

@ -1,7 +1,8 @@
@using System
@using System.Threading.Tasks
@namespace DiscordChatExporter.Core.Exporting.Writers.Html
@inherits MiniRazor.TemplateBase<DiscordChatExporter.Core.Exporting.Writers.Html.PreambleTemplateContext>
@inherits MiniRazor.TemplateBase<PreambleTemplateContext>
@{
string FormatDate(DateTimeOffset date) => Model.ExportContext.FormatDate(date);

View file

@ -1,11 +1,13 @@
@using System
@namespace DiscordChatExporter.Core.Exporting.Writers.Html
@inherits MiniRazor.TemplateBase<DiscordChatExporter.Core.Exporting.Writers.Html.PreambleTemplateContext>
@inherits MiniRazor.TemplateBase<PreambleTemplateContext>
@{
var isDarkTheme = string.Equals(Model.ThemeName, "Dark", StringComparison.OrdinalIgnoreCase);
string Themed(string darkVariant, string lightVariant) => isDarkTheme ? darkVariant : lightVariant;
string Themed(string darkVariant, string lightVariant) =>
string.Equals(Model.ThemeName, "Dark", StringComparison.OrdinalIgnoreCase)
? darkVariant
: lightVariant;
}
<style>