fixed theme select not updating (replaced js with server-side render)
This commit is contained in:
parent
0b18e1ac7e
commit
cb8e12d01d
|
@ -35,7 +35,9 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<CascadingValue Value="UserTheme" Name="UserTheme">
|
||||||
<Routes />
|
<Routes />
|
||||||
|
</CascadingValue>
|
||||||
<script src="_framework/blazor.web.js"></script>
|
<script src="_framework/blazor.web.js"></script>
|
||||||
<SectionOutlet SectionName="scripts" />
|
<SectionOutlet SectionName="scripts" />
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -61,11 +61,10 @@
|
||||||
</button>
|
</button>
|
||||||
<select id="theme-select" class="select select-bordered select-sm md:text-center join-item min-w-0 flex-1"
|
<select id="theme-select" class="select select-bordered select-sm md:text-center join-item min-w-0 flex-1"
|
||||||
onchange="window.location = `/theme/${this.value}?returnUrl=@WebUtility.UrlEncode("/" + Navigation.ToBaseRelativePath(Navigation.Uri))`">
|
onchange="window.location = `/theme/${this.value}?returnUrl=@WebUtility.UrlEncode("/" + Navigation.ToBaseRelativePath(Navigation.Uri))`">
|
||||||
<option value="">@Localizer["Theme_Default"]</option>
|
<option selected="@(UserTheme is null)" value="">@Localizer["Theme_Default"]</option>
|
||||||
<option value="wave-light">@Localizer["Theme_WaveLight"]</option>
|
<option selected="@(UserTheme is "wave-light")" value="wave-light">@Localizer["Theme_WaveLight"]</option>
|
||||||
<option value="wave-dark">@Localizer["Theme_WaveDark"]</option>
|
<option selected="@(UserTheme is "wave-dark")" value="wave-dark">@Localizer["Theme_WaveDark"]</option>
|
||||||
</select>
|
</select>
|
||||||
<script>document.getElementById("theme-select").value = document.documentElement.dataset.theme</script>
|
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
@ -78,3 +77,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[CascadingParameter(Name = "UserTheme")]
|
||||||
|
private string? UserTheme { get; set; }
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue