Merge pull request #305 from mikecasas/feature-dialog

Adds an icon for the link/button.
This commit is contained in:
Shaun Walker 2020-03-25 08:20:54 -04:00 committed by GitHub
commit ef21ae64d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@
<div class="modal-footer"> <div class="modal-footer">
@if (!string.IsNullOrEmpty(Action)) @if (!string.IsNullOrEmpty(Action))
{ {
<button type="button" class="@Class" @onclick="Confirm">@Action</button> <button type="button" class="@Class" @onclick="Confirm">@((MarkupString)_iconSpan) @Action</button>
} }
<button type="button" class="btn btn-secondary" @onclick="DisplayModal">Cancel</button> <button type="button" class="btn btn-secondary" @onclick="DisplayModal">Cancel</button>
</div> </div>
@ -30,11 +30,11 @@
{ {
if (Disabled) if (Disabled)
{ {
<button class="@Class" disabled>@Text</button> <button class="@Class" disabled>@((MarkupString)_iconSpan) @Text</button>
} }
else else
{ {
<button class="@Class" @onclick="DisplayModal">@Text</button> <button class="@Class" @onclick="DisplayModal">@((MarkupString)_iconSpan) @Text</button>
} }
} }
@ -66,9 +66,13 @@
[Parameter] [Parameter]
public Action OnClick { get; set; } // required if an Action is specified - executes a method in the calling component public Action OnClick { get; set; } // required if an Action is specified - executes a method in the calling component
[Parameter]
public string IconName { get; set; } // optional - specifies an icon for the link - default is no icon
bool _visible = false; bool _visible = false;
bool _editmode = true; bool _editmode = true;
bool _authorized = false; bool _authorized = false;
string _iconSpan = "";
protected override void OnParametersSet() protected override void OnParametersSet()
{ {
@ -84,6 +88,12 @@
{ {
_editmode = bool.Parse(EditMode); _editmode = bool.Parse(EditMode);
} }
if (!string.IsNullOrEmpty(IconName))
{
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span>&nbsp;";
}
_authorized = IsAuthorized(); _authorized = IsAuthorized();
} }