mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 19:11:10 +00:00
Adds custom checkbox razor component
This commit is contained in:
1 parent
f704a0325a
commit
98a3a23aab
2 files changed
+60
No files matched your search
@@ -0,0 +1,27 @@
|
||||
<label class="enlightenment-checkbox-label @CssClass">
|
||||
<input type="checkbox"
|
||||
class="enlightenment-checkbox-hidden"
|
||||
checked="@Checked"
|
||||
@onchange="OnChangeHandler"
|
||||
disabled="@Disabled" />
|
||||
<span class="enlightenment-checkbox"></span>
|
||||
@Label
|
||||
</label>
|
||||
|
||||
@code {
|
||||
[Parameter] public bool Checked { get; set; }
|
||||
[Parameter] public EventCallback<bool> CheckedChanged { get; set; }
|
||||
[Parameter] public string? Label { get; set; }
|
||||
[Parameter] public bool Disabled { get; set; }
|
||||
[Parameter] public string CssClass { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Handles the change event.
|
||||
/// </summary>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
private async Task OnChangeHandler(ChangeEventArgs e)
|
||||
{
|
||||
Checked = e?.Value != null ? (bool)e.Value : false;
|
||||
await CheckedChanged.InvokeAsync(Checked);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
.enlightenment-checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
color: #6DCBFE;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.enlightenment-checkbox-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.enlightenment-checkbox {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-top: #000000 1px solid;
|
||||
border-bottom: #333333 1px solid;
|
||||
border-left: #000000 1px solid;
|
||||
border-right: #333333 1px solid;
|
||||
border-radius: 0;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
background: linear-gradient(to bottom, #111, #222 50%, #333);
|
||||
}
|
||||
|
||||
.enlightenment-checkbox-hidden:checked + .enlightenment-checkbox {
|
||||
background-image: linear-gradient(180deg, #5E5D5D, #505050, #424343);
|
||||
border-top: #888888 1px solid;
|
||||
border-bottom: #333333 1px solid;
|
||||
border-left: #666666 1px solid;
|
||||
border-right: #444444 1px solid;
|
||||
}
|
||||
Reference in new issue
Block a user