项目作者: codesoroush

项目描述 :
Sweet Alert Blazor Component Withour any Js File (sweetalert blazor)
高级语言: HTML
项目地址: git://github.com/codesoroush/SAPBlazorAlert.git
创建时间: 2020-02-12T07:04:48Z
项目社区:https://github.com/codesoroush/SAPBlazorAlert

开源协议:MIT License

下载


SAPBlazorAlert

Full Css + Blazor Library for creating alert like SweetAlert without any js file.

Demo :

Demo CountPages alpha

Usage
  1. Add SAPBlazorAlert To Your Project

    1. PM> Install-Package SAPBlazorAlert -Version 1.9.1
  2. Add stylesheets either in your _host.cshtml (server-side blazor) or index.html (client-side blazor)
    ```

  1. #### TIP : by adding this component , you will install another component that u can animate elements easy. More info at end of article.
  2. 3. Add This Line in _imports.razor

@using SAPBlazorAlert
@using SAPBlazorAnimate

  1. <hr />
  2. ###### Let's Create an alert :
  3. ```Razor
  4. <button class="btn btn-info" @onclick="() => this.Alert1.ShowAlert()">
  5. show alert 1
  6. </button>
  7. <SAPAlertBox @ref="Alert1"
  8. AlertBoxSize="SAPAlertBoxSize.Small"
  9. FooterText="created by SOROUSH ASADI"
  10. SAPAlertType="@SAPAlertType.Info"
  11. AnimationType="@AnimateBook.ZoomEntrances.ZoomIn.Fast()"
  12. Title="Normal Alert">
  13. <p>
  14. you can set your alert body here ,
  15. you can add buttons , or tables and any data u want.
  16. below you can add any action and event u want
  17. </p>
  18. <button @onclick="() => this.Alert1.HideAlert()" class="btn btn-info">
  19. Ok , i got it
  20. </button>
  21. </SAPAlertBox>
Define a paremeter in code section for alert show control
  1. @code{
  2. public SAPAlertBox Alert1;
  3. }
what is AnimationType ?

you can set an animation for your alert reveal , for access to animation just use “@AnimationBook” static class.
you can pass animation reveal speed just after animation name.
if yout didnt select speed , it weill be at default.

Alert Types
  1. None (doesnt show any image)
  2. Info
  3. Success
  4. Danger
  5. Warning
  6. Custom ( you can set your img or svg on CustomAlertTypeImage="")

status

you can use Toast by this component

in your page register this element for toast container

  1. <SAPToastArea
  2. @ref="ToastArea"
  3. ToastAreatPosition="@SAPToastAreatPosition.Right"
  4. SAPToastDirection="SAPToastDirection.Column"
  5. AnimationType="@AnimateBook.Specials.JackInTheBox"
  6. >
  7. </SAPToastArea>
Define a paremeter in code section for toast show control
  1. @code{
  2. public SAPToastArea ToastArea;
  3. }
To create toast use this method
  1. @code{
  2. public SAPToastArea ToastArea;
  3. void CreateToast()
  4. {
  5. var toast = new SAPToast
  6. {
  7. Title = "sample text for toast , close after 10 sec",
  8. AlertType = SAPAlertType.Info,
  9. AutoCloseDelay= TimeSpan.FromSeconds(10)
  10. };
  11. ToastArea.CreateToast(toast);
  12. }
  13. }

this project used SAPBlazorAnimate (animate.css blazor version)