Added Customization for making narrow reader the default using DefaultNarrowReader configuration key
Some checks failed
Build, Tag, Push Docker Image / build (push) Has been cancelled
Create Release / Generate Release (push) Has been cancelled

This commit is contained in:
Mia Rose Winter 2024-03-26 15:03:01 +01:00
parent c878cdc727
commit c75d4fd5af
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
5 changed files with 11 additions and 4 deletions

View file

@ -26,7 +26,7 @@
</div> </div>
<main class="flex-1 flex flex-col"> <main class="flex-1 flex flex-col">
<SectionOutlet SectionName="GlobalHeader" /> <SectionOutlet SectionName="GlobalHeader" />
<input id="narrow-reading-toggle" type="checkbox" class="narrow-reading-toggle" /> <input id="narrow-reading-toggle" checked="@Customizations.Value.DefaultNarrowReader" type="checkbox" class="narrow-reading-toggle" />
<div class="flex-1 container mx-auto px-4 md:px-12 py-8 reading-toggle-target h-full"> <div class="flex-1 container mx-auto px-4 md:px-12 py-8 reading-toggle-target h-full">
<AlertComponent CanDelete="true" /> <AlertComponent CanDelete="true" />
@Body @Body

View file

@ -1,4 +1,10 @@
<label for="narrow-reading-toggle" class="narrow-reading-toggle btn btn-square btn-sm swap max-lg:hidden" title="@Label" onclick="this.classList.toggle('swap-active')"> @using Microsoft.Extensions.Options
@using Wave.Data
@inject IOptions<Customization> CustomizationOptions
<label for="narrow-reading-toggle"
class="btn btn-square btn-sm swap max-lg:hidden @(CustomizationOptions.Value.DefaultNarrowReader ? "swap-active":"")"
title="@Label" onclick="this.classList.toggle('swap-active')">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="currentColor" class="swap-on fill-current"> <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="currentColor" class="swap-on fill-current">
<path fill-rule="evenodd" d="M15 3.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0V5.56l-3.97 3.97a.75.75 0 1 1-1.06-1.06l3.97-3.97h-2.69a.75.75 0 0 1-.75-.75Zm-12 0A.75.75 0 0 1 3.75 3h4.5a.75.75 0 0 1 0 1.5H5.56l3.97 3.97a.75.75 0 0 1-1.06 1.06L4.5 5.56v2.69a.75.75 0 0 1-1.5 0v-4.5Zm11.47 11.78a.75.75 0 1 1 1.06-1.06l3.97 3.97v-2.69a.75.75 0 0 1 1.5 0v4.5a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1 0-1.5h2.69l-3.97-3.97Zm-4.94-1.06a.75.75 0 0 1 0 1.06L5.56 19.5h2.69a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75v-4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0Z" clip-rule="evenodd"/> <path fill-rule="evenodd" d="M15 3.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0V5.56l-3.97 3.97a.75.75 0 1 1-1.06-1.06l3.97-3.97h-2.69a.75.75 0 0 1-.75-.75Zm-12 0A.75.75 0 0 1 3.75 3h4.5a.75.75 0 0 1 0 1.5H5.56l3.97 3.97a.75.75 0 0 1-1.06 1.06L4.5 5.56v2.69a.75.75 0 0 1-1.5 0v-4.5Zm11.47 11.78a.75.75 0 1 1 1.06-1.06l3.97 3.97v-2.69a.75.75 0 0 1 1.5 0v4.5a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1 0-1.5h2.69l-3.97-3.97Zm-4.94-1.06a.75.75 0 0 1 0 1.06L5.56 19.5h2.69a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75v-4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0Z" clip-rule="evenodd"/>
</svg> </svg>

View file

@ -6,6 +6,7 @@ public class Customization {
public string AppUrl { get; set; } = "http://localhost"; public string AppUrl { get; set; } = "http://localhost";
public string DefaultTheme { get; set; } = ""; public string DefaultTheme { get; set; } = "";
public string DefaultLanguage { get; set; } = ""; public string DefaultLanguage { get; set; } = "";
public bool DefaultNarrowReader { get; set; } = false;
public string LogoLink { get; set; } = ""; public string LogoLink { get; set; } = "";
public string Footer { get; set; } = ""; public string Footer { get; set; } = "";
} }

View file

@ -36,7 +36,7 @@ @layer components {
input.narrow-reading-toggle { input.narrow-reading-toggle {
display: none; display: none;
} }
input.narrow-reading-toggle:checked ~ .reading-toggle-target { body:has(label[for=narrow-reading-toggle]) input.narrow-reading-toggle:checked + .reading-toggle-target {
@apply max-w-3xl; @apply max-w-3xl;
} }

File diff suppressed because one or more lines are too long