Skip to content

Commit

Permalink
Fix #1425 - implement EventCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
vnbaaij committed Feb 2, 2024
1 parent 01afa3a commit 36f67c1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Core/Components/Anchor/FluentAnchor.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public partial class FluentAnchor : FluentComponentBase, IAsyncDisposable
public string? Rel { get; set; }

/// <summary>
/// Gets or sets the target attribute that specifies where to open the link, if Href is specified.
/// Gets or sets the target attribute that specifies where to open the link, if Href is specified.
/// Possible values: _blank | _self | _parent | _top.
/// </summary>
[Parameter]
Expand Down Expand Up @@ -82,6 +82,9 @@ public partial class FluentAnchor : FluentComponentBase, IAsyncDisposable
[Parameter]
public Icon? IconEnd { get; set; }

[Parameter]
public EventCallback OnClick { get; set; }

/// <summary>
/// Gets or sets the content to be rendered inside the component.
/// </summary>
Expand Down Expand Up @@ -132,6 +135,10 @@ private async Task OnClickAsync()
// If the target ID has been specified, we know this is an anchor link that we need to scroll to
await _jsModule.InvokeVoidAsync("scrollIntoView", _targetId);
}
if (OnClick.HasDelegate)
{
await OnClick.InvokeAsync();
}
}

/// <inheritdoc />
Expand Down

0 comments on commit 36f67c1

Please sign in to comment.