summaryrefslogtreecommitdiff
path: root/Pages/Component/TabContainer.razor
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2026-03-17 03:04:36 +1100
committerJake Mannens <jake@asger.xyz>2026-03-25 01:57:41 +1100
commitc751709b1b4fe6f16fd84647e8e071455e7b78d6 (patch)
tree47734a083d888660606e6cf6cf158c93e69a9807 /Pages/Component/TabContainer.razor
v0.1av0.1a
Diffstat (limited to 'Pages/Component/TabContainer.razor')
-rw-r--r--Pages/Component/TabContainer.razor35
1 files changed, 35 insertions, 0 deletions
diff --git a/Pages/Component/TabContainer.razor b/Pages/Component/TabContainer.razor
new file mode 100644
index 0000000..3caab0b
--- /dev/null
+++ b/Pages/Component/TabContainer.razor
@@ -0,0 +1,35 @@
+<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/>
+
+<div class="tabs">
+ @foreach(var pane in Panes) {
+ <a href="javascript:;" @onclick=@(() => ActivePane = pane) class="@(pane == ActivePane ? "selected" : "")">
+ @pane.Title
+ </a>
+ }
+</div>
+
+<CascadingValue Value="this">
+ @ChildContent
+</CascadingValue>
+
+@code {
+ [Parameter]
+ public RenderFragment ChildContent { get; set; }
+
+ public TabPane? ActivePane { get; set; }
+ List<TabPane> Panes = new();
+
+ public void AddPane(TabPane tabPane) {
+ Panes.Add(tabPane);
+ if(Panes.Count == 1)
+ ActivePane = tabPane;
+ StateHasChanged();
+ }
+
+ public void RemovePane(TabPane tabPane) {
+ if(ActivePane == tabPane)
+ ActivePane = Panes.ElementAtOrDefault(0);
+ Panes.Remove(tabPane);
+ StateHasChanged();
+ }
+} \ No newline at end of file