Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Core/Components/Toast/FluentToast.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@namespace Microsoft.FluentUI.AspNetCore.Components

<CascadingValue Value="this" IsFixed="true">
<div class="fluent-toast" id="@Id" tabindex="0" >
<div class="@Class" style="@Style" id="@Id" tabindex="0">
<FluentStack Orientation="Orientation.Horizontal" Width="100%" VerticalAlignment="VerticalAlignment.Center" HorizontalGap="8">
@if (_parameters.Icon is not null)
{
Expand All @@ -29,7 +29,7 @@
break;
case ToastTopCTAType.Action:
<FluentAnchor title="@_parameters.TopAction"
Href="#"
Href="#"
Style="font-size: 14px; font-weight:400;"
Appearance="Appearance.Hypertext"
@onfocusin="@PauseTimeout"
Expand Down Expand Up @@ -63,7 +63,7 @@
@if (_parameters.SecondaryAction is not null)
{
<FluentAnchor title="@_parameters.SecondaryAction"
Href="#"
Href="#"
Style="font-size: 14px; font-weight:400;"
Appearance="Appearance.Hypertext"
@onfocusin="@PauseTimeout"
Expand Down
5 changes: 5 additions & 0 deletions src/Core/Components/Toast/FluentToast.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// ------------------------------------------------------------------------

using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;

Expand All @@ -23,6 +24,10 @@ public partial class FluentToast : FluentComponentBase, IDisposable
protected override async Task OnInitializedAsync()
{
_parameters = Instance.Parameters;

Class = new CssBuilder("fluent-toast").AddClass(_parameters.Class).Build();
Style = new StyleBuilder(_parameters.Style).Build();

ToastContext!.Register(this);

if (_parameters.Timeout.HasValue && _parameters.Timeout == 0)
Expand Down
5 changes: 4 additions & 1 deletion src/Core/Components/Toast/Parameters/IToastParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ public interface IToastParameters
{
string? Id { get; set; }
ToastIntent Intent { get; set; }
(Icon Value, Color Color)? Icon { get; set; }
string? Title { get; set; }

(Icon Value, Color Color)? Icon { get; set; }
string? Style { get; set; }
string? Class { get; set; }

ToastTopCTAType TopCTAType { get; set; }
string? TopAction { get; set; }
EventCallback<ToastResult>? OnTopAction { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions src/Core/Components/Toast/Parameters/ToastParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public class ToastParameters : ComponentParameters, IToastParameters
public EventCallback<ToastResult>? OnTopAction { get; set; } = default!;

public (Icon Value, Color Color)? Icon { get; set; }
public string? Style { get; set; }
public string? Class { get; set; }

public DateTime Timestamp { get; set; } = DateTime.Now;
public int? Timeout { get; set; }

Expand Down
Loading