Added footer Customization support

This commit is contained in:
Mia Rose Winter 2024-01-23 14:27:42 +01:00
parent 7c3fecf70b
commit 37f16270b6
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
4 changed files with 16 additions and 3 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,10 +1,13 @@
@using System.Globalization
@using System.Net
@using Microsoft.Extensions.Options
@using Wave.Data
@using Wave.Utilities
@inherits LayoutComponentBase
@inject NavigationManager Navigation
@inject IOptions<RequestLocalizationOptions> LocalizationOptions
@inject IOptions<Customization> Customizations
@inject IStringLocalizer<MainLayout> Localizer
<div class="drawer md:drawer-open drawer-end">
@ -26,8 +29,12 @@
</main>
<footer class="flex flex-col md:flex-row items-center justify-center p-4 gap-y-3 gap-x-4 bg-base-300 text-base-content">
<span class="flex-1 text-center md:text-left">
Powered by
<a class="link link-primary" target="_blank" href="https://github.com/miawinter98/Wave">Wave</a>
@if (Customizations.Value.Footer is { } footer && !string.IsNullOrWhiteSpace(footer)) {
<span class="prose prose-neutral">@MarkdownUtilities.ParseToMarkup(footer)</span>
} else {
<text>Powered by</text>
<a class="link link-primary" target="_blank" href="https://github.com/miawinter98/Wave">Wave</a>
}
</span>
<div class="join w-56" title="@Localizer["Language_Label"]">
<button type="button" class="btn btn-sm btn-neutral btn-square no-animation join-item">

View file

@ -2,4 +2,5 @@
public class Customization {
public string AppName { get; set; } = "Wave";
public string Footer { get; set; } = "";
}

View file

@ -1,4 +1,5 @@
using Markdig;
using Microsoft.AspNetCore.Components;
using Wave.Data;
namespace Wave.Utilities;
@ -12,4 +13,8 @@ public static class MarkdownUtilities {
.Build();
return Markdown.ToHtml(markdown, pipeline);
}
public static MarkupString ParseToMarkup(string markdown) {
return new MarkupString(Parse(markdown));
}
}