mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-12 11:55:24 +08:00
9fa391449a
* style: update editorconfig - update editorconfig encoding to utf8 - add CA1852 and IDE0005 rules * style: apply dotnet-format * style: add IDE0040 rule * style: apply dotnet-format * refactor: sealed SimpleEmbeddedJsonLocalizerFactory * style: add style rule for modifiers * fix: resolve dotnet-format unmerged issue * fix: add back translation --------- Co-authored-by: James Yeung <shunjiey@hotmail.com>
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.Extensions.Localization;
|
|
using Microsoft.JSInterop;
|
|
|
|
namespace AntDesign.Docs.Shared
|
|
{
|
|
public partial class FixedWidgets
|
|
{
|
|
[Inject] private IStringLocalizer Localizer { get; set; }
|
|
[Inject] private IJSRuntime JS { get; set; }
|
|
|
|
private ElementReference _linkRef;
|
|
|
|
private string _themeFileUrl;
|
|
|
|
|
|
private async Task ChangeTheme(string theme)
|
|
{
|
|
_themeFileUrl = $"_content/AntDesign.Docs/css/{theme}.css";
|
|
|
|
_ = JS.InvokeVoidAsync(JSInteropConstants.AddElementToBody, _linkRef);
|
|
_ = JS.InvokeVoidAsync(JSInteropConstants.SetDomAttribute, "html", new Dictionary<string, string>
|
|
{
|
|
["data-theme"] = theme
|
|
});
|
|
}
|
|
}
|
|
}
|