ant-design-blazor/components/modal/ConfirmDialog.razor
zxyao 6db07ad916 feat: add component modal (#167)
* feat: add component modal

* fix: adjust namespace and fix TAB keyboard bug

* fix: reset package.json to cuueernt head

* fix: remove antblazor.sln

* refactor: using c# to control the display and hiding of modal
2020-06-02 14:25:44 +08:00

100 lines
3.2 KiB
C#

@namespace AntDesign
@inherits AntDomComponentBase
@{
var dialogOptions = BuildDialogOptions(Config);
}
<Dialog Config="@dialogOptions" Visible="@Config.Visible" Style="@Config.Style">
<div class="ant-modal-confirm-body-wrapper">
<div class="ant-modal-confirm-body">
@if (Config.Icon != null)
{
@(Config.Icon)
}
@if(Config.Title != null)
{
var titleValue = Config.Title.Value;
<span class="ant-modal-confirm-title">
@if (titleValue.IsT0)
{
@(titleValue.AsT0)
}
else
{
@(titleValue.AsT1)
}
</span>
}
<div class="ant-modal-confirm-content">
@if (Config.Content.IsT0)
{
@(Config.Content.AsT0)
}
else
{
@(Config.Content.AsT1)
}
</div>
</div>
<div class="ant-modal-confirm-btns">
@{
var cancelProps = Config.CancelButtonProps;
var okProps = Config.OkButtonProps;
}
@if (Config.OkCancel)
{
<Button @ref="_cancelBtn"
OnClick="@HandleCancel"
Block="@cancelProps.Block"
Ghost="@cancelProps.Ghost"
Search="@cancelProps.Search"
Loading="@cancelProps.Loading"
Type="@cancelProps.Type"
Shape="@cancelProps.Shape"
Size="@cancelProps.Size"
Icon="@cancelProps.Icon"
Disabled="@cancelProps.Disabled"
Danger="@cancelProps.Danger">
@{
if (Config.CancelText.IsT0)
{
@(Config.CancelText.AsT0)
}
else
{
@(Config.CancelText.AsT1)
}
}
</Button>
}
<Button @ref="_okBtn"
OnClick="@HandleOk"
Loading="@okProps.Loading"
Type="@okProps.Type"
Block="@okProps.Block"
Ghost="@okProps.Ghost"
Search="@okProps.Search"
Shape="@okProps.Shape"
Size="@okProps.Size"
Icon="@okProps.Icon"
Disabled="@okProps.Disabled"
Danger="@okProps.Danger">
@{
if (Config.OkText.IsT0)
{
@(Config.OkText.AsT0)
}
else
{
@(Config.OkText.AsT1)
}
}
</Button>
</div>
</div>
</Dialog>