-
Notifications
You must be signed in to change notification settings - Fork 12
Icon dynamic PoC #2827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Icon dynamic PoC #2827
Conversation
| { | ||
| var prefersDark = await JSRuntime!.InvokeAsync<bool>("DemoShared.PrefersColorScheme.prefersDark"); | ||
| Theme = prefersDark ? Theme.Dark : Theme.Light; | ||
| await JSRuntime!.InvokeVoidAsync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make a new helper component in the OkBlazor library like OkIconDynamic that has a static function to call this for the user.
Something like:
public partial class OkIconDynamic : ComponentBase
{
public static async Task RegisterIconDynamicAsync(IJSRuntime jsRuntime, string name, string url)
{
await jsRuntime.InvokeVoidAsync(
"DemoShared.IconDynamic.registerIconDynamic",
name,
url);
}
}| IconDynamic: { | ||
| registerIconDynamic: function (name, url) { | ||
| const registerIconDynamic = window.customElements.get('ok-icon-dynamic').registerIconDynamic; | ||
| registerIconDynamic(name, url); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To align with above, this should be moved to the OkBlazor.lib.module.js in the window.OkBlazor object:
| window.OkBlazor = window.OkBlazor ?? { | |
| isReady: () => isReady | |
| }; |
Pull Request
π€¨ Rationale
π©βπ» Implementation
π§ͺ Testing
β Checklist