jsedlak / tazor

A tailwind ui toolkit for blazor
MIT License
2 stars 0 forks source link

Rework service includes to a fluent pattern #40

Closed jsedlak closed 3 days ago

jsedlak commented 4 days ago

Currently, Tazor is added in complete with a single statement

builder.Services.AddTazor();

But behind the scenes, this adds a number of services.

public static void AddTazor(this IServiceCollection services)
{
    services.AddScoped<OnlineStatusInterop>();
    services.AddScoped<BreakpointInterop>();
    services.AddSingleton<INotificationProvider, DefaultNotificationProvider>();
}

Instead, the AddTazor method should return a fluent interface to support adding custom providers:

builder.Services.AddTazor()
  .WithInMemoryNotifications()
  .WithGravatarAvatars()

This will allow end-users to add their own providers more easily