summaryrefslogtreecommitdiff
path: root/Pages/Component/TabPane.razor
blob: ba4a13aae3cf01699a5c5958b3df2745bc053e56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@implements IDisposable

<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/>

@if(Parent.ActivePane == this) {
    @ChildContent
}

@code {
    [CascadingParameter]
    private TabContainer Parent { get; set; }

    [Parameter]
    public string Title { get; set; }

    [Parameter]
    public RenderFragment ChildContent { get; set; }

    protected override void OnInitialized() {
        if (Parent is null)
            throw new ArgumentNullException(nameof(Parent), "TabPane must exist within a TabContainer");

        Parent.AddPane(this);
    }

    public void Dispose() {
        Parent.RemovePane(this);
    }
}