-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻ refactor: working on move alert to masablazor
- Loading branch information
Showing
5 changed files
with
248 additions
and
22 deletions.
There are no files selected for viewing
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,11 @@ | ||
namespace BlazorComponent | ||
{ | ||
public enum AlertTypes | ||
{ | ||
None = 0, | ||
Success, | ||
Info, | ||
Warning, | ||
Error | ||
} | ||
} |
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,86 @@ | ||
@namespace Masa.Blazor | ||
@inherits BDomComponentBase | ||
|
||
<CascadingValue Value="IsDark" Name="IsDark"> | ||
@if (Transition != null) | ||
{ | ||
<Transition Name="@Transition"> | ||
<ShowTransitionElement Value="Value" | ||
Tag="@Tag" | ||
role="alert" | ||
Class="@CssProvider.GetClass()" | ||
Style="@CssProvider.GetStyle()" | ||
id="@Id"> | ||
@RenderWrapper() | ||
</ShowTransitionElement> | ||
</Transition> | ||
} | ||
else | ||
{ | ||
<Element Tag="@Tag" | ||
role="alert" | ||
Class="@CssProvider.GetClass()" | ||
style="@CssProvider.GetStyle()" | ||
id="@Id"> | ||
@RenderWrapper() | ||
</Element> | ||
} | ||
</CascadingValue> | ||
|
||
@code { | ||
|
||
private RenderFragment RenderWrapper() => __builder => | ||
{ | ||
<div class="@CssProvider.GetClass("wrapper")" | ||
style="@CssProvider.GetStyle("wrapper")"> | ||
@if (IsShowIcon) | ||
{ | ||
<MIcon Color="@IconColor" | ||
Dark="@IsDarkTheme" | ||
Class="m-alert__icon"> | ||
@IconContent | ||
</MIcon> | ||
} | ||
|
||
<div class="@CssProvider.GetClass("content")"> | ||
@if (HasTitle) | ||
{ | ||
<div class="@CssProvider.GetClass("title")"> | ||
@if (TitleContent == null) | ||
{ | ||
@Title | ||
} | ||
else | ||
{ | ||
@TitleContent | ||
} | ||
</div> | ||
} | ||
|
||
@ChildContent | ||
</div> | ||
|
||
|
||
@if (Border != Borders.None) | ||
{ | ||
<div class="@CssProvider.GetClass("border")" | ||
style="@CssProvider.GetStyle("border")"> | ||
</div> | ||
} | ||
|
||
@if (Dismissible) | ||
{ | ||
<MButton Class="m-alert__dismissible" | ||
Color="@IconColor" | ||
Dark="@IsDarkTheme" | ||
Icon | ||
Small | ||
OnClick="@HandleOnDismiss" | ||
aria-label="@CloseLabel"> | ||
<MIcon Dark="@IsDarkTheme">@CloseIcon</MIcon> | ||
</MButton> | ||
} | ||
</div> | ||
}; | ||
|
||
} |
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
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
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