Bootswatch themes in Oqtane.Themes.OqtaneTheme
Theme is set in Oqtane.Client\Themes\OqtaneTheme\Default.razor ``` protected override async Task OnParametersSetAsync() { // go to https://www.bootstrapcdn.com/bootswatch/ and take your favorite theme //<link href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css" rel="stylesheet" integrity="sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM" crossorigin="anonymous"> await LoadBootstrapTheme("https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css","sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM"); await IncludeCSS("Theme.css"); } ```
This commit is contained in:
@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
|
// go to https://www.bootstrapcdn.com/bootswatch/ and take your favorite theme
|
||||||
|
//<link href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css" rel="stylesheet" integrity="sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM" crossorigin="anonymous">
|
||||||
|
await LoadBootstrapTheme("https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css","sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM");
|
||||||
await IncludeCSS("Theme.css");
|
await IncludeCSS("Theme.css");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.JSInterop;
|
using Microsoft.JSInterop;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using Oqtane.UI;
|
using Oqtane.UI;
|
||||||
@ -30,6 +30,13 @@ namespace Oqtane.Themes
|
|||||||
await interop.IncludeCSS("Theme", Url);
|
await interop.IncludeCSS("Theme", Url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task LoadBootstrapTheme(string url, string integrity = null)
|
||||||
|
{
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
string crossorigin = string.IsNullOrEmpty(integrity) ? string.Empty : "anonymous";
|
||||||
|
await interop.IncludeLink("bootstrap", "stylesheet", url, "text/css", integrity, crossorigin);
|
||||||
|
}
|
||||||
|
|
||||||
public string NavigateUrl()
|
public string NavigateUrl()
|
||||||
{
|
{
|
||||||
return NavigateUrl(PageState.Page.Path);
|
return NavigateUrl(PageState.Page.Path);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -70,7 +70,7 @@ window.interop = {
|
|||||||
link.integrity = integrity;
|
link.integrity = integrity;
|
||||||
}
|
}
|
||||||
if (crossorigin !== "") {
|
if (crossorigin !== "") {
|
||||||
link.crossorigin = crossorigin;
|
link.crossOrigin = crossorigin;
|
||||||
}
|
}
|
||||||
document.head.appendChild(link);
|
document.head.appendChild(link);
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ window.interop = {
|
|||||||
if (integrity !== "" && link.integrity !== integrity) {
|
if (integrity !== "" && link.integrity !== integrity) {
|
||||||
link.setAttribute('integrity', integrity);
|
link.setAttribute('integrity', integrity);
|
||||||
}
|
}
|
||||||
if (crossorigin !== "" && link.crossorigin !== crossorigin) {
|
if (crossorigin !== "" && link.crossOrigin !== crossorigin) {
|
||||||
link.setAttribute('crossorigin', crossorigin);
|
link.setAttribute('crossorigin', crossorigin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user