-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Toast and Offcanvas #750
Comments
@cmorgado Thank you for using BlazorBootstrap. I'm not able to reproduce the issue. Please share a sample code or a GitHub repo with minimal steps to reproduce the issue. Example 1: <Offcanvas @ref="offcanvas"
title="Offcanvas title"
OnShowing="OnOffcanvasShowing"
OnShown="OnOffcanvasShown"
OnHiding="OnOffcanvasHiding"
OnHidden="OnOffcanvasHidden">
<BodyTemplate>
<div>Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.</div>
</BodyTemplate>
<FooterTemplate>
<Button Color="ButtonColor.Primary" @onclick="OnHideOffcanvasClick">Hide Offcanvas</Button>
</FooterTemplate>
</Offcanvas>
<Button Color="ButtonColor.Primary" @onclick="OnShowOffcanvasClick">Show offcanvas</Button>
<Toasts class="p-3" Messages="messages" AutoHide="true" StackLength="3" Placement="ToastsPlacement.TopRight" />
@code {
private Offcanvas offcanvas = default!;
List<ToastMessage> messages = new List<ToastMessage>();
private void ShowMessage(ToastType toastType, string message)
=> messages.Add(CreateToastMessage(toastType, message));
private ToastMessage CreateToastMessage(ToastType toastType, string message)
=> new ToastMessage
{
Type = toastType,
Title = "Blazor Bootstrap",
HelpText = $"{DateTime.Now}",
Message = $"Event {message}. DateTime: {DateTime.Now}",
};
private async Task OnShowOffcanvasClick() => await offcanvas.ShowAsync();
private async Task OnHideOffcanvasClick() => await offcanvas.HideAsync();
private void OnOffcanvasShowing() => ShowMessage(ToastType.Primary, "Event: Showing");
private void OnOffcanvasShown() => ShowMessage(ToastType.Secondary, "Event: Shown");
private void OnOffcanvasHiding() => ShowMessage(ToastType.Success, "Event: Hiding");
private void OnOffcanvasHidden() => ShowMessage(ToastType.Danger, "Event: Hidden");
} Screenshot: Example 2: <Offcanvas @ref="offcanvas"
title="Offcanvas title"
OnShowing="OnOffcanvasShowing"
OnShown="OnOffcanvasShown"
OnHiding="OnOffcanvasHiding"
OnHidden="OnOffcanvasHidden">
<BodyTemplate>
<div>Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.</div>
</BodyTemplate>
<FooterTemplate>
<Button Color="ButtonColor.Primary" @onclick="OnHideOffcanvasClick">Hide Offcanvas</Button>
</FooterTemplate>
</Offcanvas>
<Button Color="ButtonColor.Primary" @onclick="OnShowOffcanvasClick">Show offcanvas</Button>
@code {
private Offcanvas offcanvas = default!;
[Inject] ToastService ToastService { get; set; } = default!;
private async Task OnShowOffcanvasClick() => await offcanvas.ShowAsync();
private async Task OnHideOffcanvasClick() => await offcanvas.HideAsync();
private void OnOffcanvasShowing() => ToastService.Notify(new(ToastType.Primary, "Event: Showing"));
private void OnOffcanvasShown() => ToastService.Notify(new(ToastType.Success, "Event: Shown"));
private void OnOffcanvasHiding() => ToastService.Notify(new(ToastType.Danger, "Event: Hiding"));
private void OnOffcanvasHidden() => ToastService.Notify(new(ToastType.Warning, "Event: Hidden"));
} Screenshot: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I open a offcanvas ex: right side and then try to open a Toast in the top right, the toast end up being "hidden" below the offcanvas
Expected behavior
The Toast should be on top of offcanvas
NET 8.0
Blazor Interactive Render Mode: Server
The text was updated successfully, but these errors were encountered: