about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/SimpleComponents
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Shared/SimpleComponents')
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor38
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor29
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor.css5
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/LinkButton.razor20
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/StringListEditor.razor29
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/ToggleSlider.razor72
6 files changed, 0 insertions, 193 deletions
diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor
deleted file mode 100644
index afd1fdc..0000000
--- a/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor
+++ /dev/null
@@ -1,38 +0,0 @@
-@using LibMatrix.Extensions
-<table>
-    @foreach (var i in Items.Keys) {
-        var key = i;
-        <input value="@Items[key]" @oninput="obj => inputChanged(obj, key)">
-        <button @onclick="() => { Items.Remove(key); ItemsChanged.InvokeAsync(); }">Remove</button>
-        <br/>
-    }
-</table>
-<button @onclick="() => { Items.Add(string.Empty, default); ItemsChanged.InvokeAsync(); }">Add</button>
-
-@code {
-
-    [Parameter]
-    public Dictionary<string, object> Items { get; set; } = new();
-
-    [Parameter]
-    [EditorRequired]
-    public EventCallback ItemsChanged { get; set; }
-
-    [Parameter]
-    public Func<string, string>? KeyFormatter { get; set; }
-
-    [Parameter]
-    public Action? OnFocusLost { get; set; }
-
-    protected override Task OnInitializedAsync() {
-        Console.WriteLine($"DictionaryEditor initialized with {Items.Count} items: {Items.ToJson()}");
-        return base.OnInitializedAsync();
-    }
-
-    private void inputChanged(ChangeEventArgs obj, string key) {
-        Console.WriteLine($"StringListEditor inputChanged {key} {obj.Value}");
-        Items[key] = obj.Value.ToString();
-        ItemsChanged.InvokeAsync();
-    }
-
-}
diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor
deleted file mode 100644
index 966c44d..0000000
--- a/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor
+++ /dev/null
@@ -1,29 +0,0 @@
-@inject IJSRuntime JsRuntime
-@if (isVisible) {
-    <input autofocus type="@(IsPassword ? "password" : "text")" @bind="Value" @onfocusout="() => { isVisible = false; ValueChanged.InvokeAsync(Value); }" @ref="elementToFocus"/>
-}
-else {
-    <span class="fancy-textbox-inline" tabindex="0" style="@(string.IsNullOrEmpty(Value) ? "min-width: 50px;" : "")" @onfocusin="() => isVisible = true">@(Formatter?.Invoke(Value) ?? (IsPassword ? string.Join("", Value.Select(x => '*')) : Value))</span>
-}
-
-@code {
-
-    [Parameter]
-    public string Value { get; set; }
-
-    [Parameter]
-    public bool IsPassword { get; set; } = false;
-
-    [Parameter]
-    public EventCallback<string> ValueChanged { get; set; }
-
-    [Parameter]
-    public Func<string?, string>? Formatter { get; set; }
-
-    private bool isVisible { get; set; } = false;
-
-    private ElementReference elementToFocus;
-
-    protected override async Task OnAfterRenderAsync(bool firstRender) => await JsRuntime.InvokeVoidAsync("BlazorFocusElement", elementToFocus);
-
-}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor.css b/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor.css
deleted file mode 100644
index 01b2c6f..0000000
--- a/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor.css
+++ /dev/null
@@ -1,5 +0,0 @@
-.fancy-textbox-inline {
-    border-bottom: #ccc solid 1px;
-    height: 1.4em;
-    display: inline-block;
-}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/LinkButton.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/LinkButton.razor
deleted file mode 100644
index b800989..0000000
--- a/MatrixRoomUtils.Web/Shared/SimpleComponents/LinkButton.razor
+++ /dev/null
@@ -1,20 +0,0 @@
-<a href="@href" class="btn btn-primary" @onclick="@(() => OnClick?.Invoke())"
-   style="background-color: @(Color ?? "#1b6ec2");">
-    @ChildContent
-</a>
-
-@code {
-
-    [Parameter]
-    public string? href { get; set; }
-
-    [Parameter]
-    public RenderFragment ChildContent { get; set; }
-
-    [Parameter]
-    public string? Color { get; set; }
-
-    [Parameter]
-    public Func<Task>? OnClick { get; set; }
-
-}
diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/StringListEditor.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/StringListEditor.razor
deleted file mode 100644
index 2bd6ed5..0000000
--- a/MatrixRoomUtils.Web/Shared/SimpleComponents/StringListEditor.razor
+++ /dev/null
@@ -1,29 +0,0 @@
-@for (var i = 0; i < Items.Count; i++) {
-    var self = i;
-    <button @onclick="() => { Items.RemoveAt(self); ItemsChanged.InvokeAsync(); }">Remove</button>
-    <FancyTextBox Value="@Items[self]" ValueChanged="@(obj => inputChanged(obj, self))"/>
-    <br/>
-}
-<button @onclick="() => { Items.Add(string.Empty); ItemsChanged.InvokeAsync(); }">Add</button>
-
-@code {
-
-    [Parameter]
-    public List<string> Items { get; set; } = new();
-
-    [Parameter]
-    [EditorRequired]
-    public EventCallback ItemsChanged { get; set; }
-
-    protected override Task OnInitializedAsync() {
-        Console.WriteLine($"StringListEditor initialized with {Items.Count} items: {string.Join(",", Items)}");
-        return base.OnInitializedAsync();
-    }
-
-    private void inputChanged(string obj, int i) {
-        Console.WriteLine($"StringListEditor inputChanged {i} {obj}");
-        Items[i] = obj;
-        ItemsChanged.InvokeAsync();
-    }
-
-}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/ToggleSlider.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/ToggleSlider.razor
deleted file mode 100644
index 1a38e26..0000000
--- a/MatrixRoomUtils.Web/Shared/SimpleComponents/ToggleSlider.razor
+++ /dev/null
@@ -1,72 +0,0 @@
-<input type="checkbox"/><span>@ChildContent</span>
-
-<div class="container">
-    <label class="switch" for="checkbox">
-        <input type="checkbox" id="checkbox" @bind="Value"/>
-        <div class="slider round"></div>
-    </label>
-</div>
-
-<style>
-    .switch {
-      display: inline-block;
-      height: 16px;
-      position: relative;
-      width: 32px;
-    }
-    
-    .switch input {
-      display:none;
-    }
-    
-    .slider {
-      background-color: #ccc;
-      bottom: 0;
-      cursor: pointer;
-      left: 0;
-      position: absolute;
-      right: 0;
-      top: 0;
-      transition: .4s;
-    }
-    
-    .slider:before {
-      background-color: #fff;
-      bottom: -5px;
-      content: "";
-      height: 26px;
-      left: -8px;
-      position: absolute;
-      transition: .4s;
-      width: 26px;
-    }
-    
-    input:checked + .slider {
-      background-color: #66bb6a;
-    }
-    
-    input:checked + .slider:before {
-      transform: translateX(24px);
-    }
-    
-    .slider.round {
-      border-radius: 24px;
-    }
-    
-    .slider.round:before {
-      border-radius: 50%;
-    }
-</style>
-
-@code {
-
-    [Parameter]
-    public RenderFragment? ChildContent { get; set; }
-
-    [Parameter]
-    public bool Value { get; set; }
-
-    [Parameter]
-    public EventCallback<bool> ValueChanged { get; set; }
-
-}
\ No newline at end of file