-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d94318d
commit cfaf0c8
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
SiemensIXBlazor/Components/ContentHeader/ContentHeader.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@namespace SiemensIXBlazor.Components | ||
@using Microsoft.JSInterop; | ||
@using SiemensIXBlazor.Enums.ContentHeader; | ||
@using SiemensIXBlazor.Helpers; | ||
@inherits IXBaseComponent | ||
@inject IJSRuntime JSRuntime | ||
|
||
<ix-content-header @attributes="UserAttributes" | ||
class="@Class" | ||
style="@Style" | ||
id="@Id" | ||
has-back-button="@HasBackButton" | ||
header-title="@HeaderTitle" | ||
header-subtitle="@HeaderSubTitle" | ||
variant="@(EnumParser<ContentHeaderVariant>.ParseEnumToString(Variant))"> | ||
@ChildContent | ||
</ix-content-header> |
43 changes: 43 additions & 0 deletions
43
SiemensIXBlazor/Components/ContentHeader/ContentHeader.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.JSInterop; | ||
using SiemensIXBlazor.Enums.ContentHeader; | ||
using SiemensIXBlazor.Interops; | ||
|
||
namespace SiemensIXBlazor.Components | ||
{ | ||
public partial class ContentHeader | ||
{ | ||
[Parameter, EditorRequired] | ||
public string Id { get; set; } = string.Empty; | ||
[Parameter] | ||
public RenderFragment? ChildContent { get; set; } | ||
[Parameter] | ||
public bool HasBackButton { get; set; } = false; | ||
[Parameter] | ||
public string? HeaderSubTitle { get; set; } | ||
[Parameter] | ||
public string? HeaderTitle { get; set; } | ||
[Parameter] | ||
public ContentHeaderVariant Variant { get; set; } = ContentHeaderVariant.Primary; | ||
[Parameter] | ||
public EventCallback BackButtonClickedEvent { get; set; } | ||
|
||
private BaseInterop _interop; | ||
|
||
protected async override Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
if (firstRender) | ||
{ | ||
_interop = new(JSRuntime); | ||
|
||
await _interop.AddEventListener(this, Id, "backButtonClick", "BackButtonClicked"); | ||
} | ||
} | ||
|
||
[JSInvokable] | ||
public async void BackButtonClicked() | ||
{ | ||
await BackButtonClickedEvent.InvokeAsync(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace SiemensIXBlazor.Enums.ContentHeader | ||
{ | ||
public enum ContentHeaderVariant | ||
{ | ||
Primary, | ||
Secondary | ||
} | ||
} |